SQL error
relation "pet" does not exist / no such table: pet
Updated · Tested on PostgreSQL 18.6 and SQLite 3.54.1 (results generated , re-checked on every release)
Short answer
The database can't find a table with that exact name in the schemas it searches. Usually it's a typo or singular/plural mix-up, a table created with quoted capitals, or a table that lives in another schema.
The exact messages
- PostgreSQLERROR: relation "pet" does not exist
- SQLiteno such table: pet
How to read this message
This is what PostgreSQL 18.6 prints for the broken query below, the way psql shows it. LINE gives the line it was reading when it gave up, and the ^ marks the exact spot.
ERROR: relation "pet" does not exist
LINE 1: SELECT * FROM pet;
^SQLite 3.54.1 reports the same mistake as no such table: pet, with no line number: look for the word or column it names.
Why it happens
Typo or singular vs plural
pet vs pets. Check the real name: in PostgreSQL run \dt in psql, in SQLite run .tables.
Quoted capitals
A table created as "Pets" must always be written "Pets". Unquoted names are folded to lowercase in PostgreSQL.
A different schema
PostgreSQL only searches the schemas in search_path (usually public). Use schema_name.table_name or update the search path.
Wrong database or uncommitted table
You may be connected to a different database, or the CREATE TABLE ran in a transaction that was rolled back.
Reproduce it, then fix it
Both queries run on a real database in your browser. Switch dialects to compare.
SELECT * FROM pet;SELECT * FROM pets;Use the exact table name. When in doubt, list the tables first.
The fix returns, PostgreSQL: first 6 of 20 rows
| id | name | species | breed | age | weight_kg | adopted | arrived_on |
|---|---|---|---|---|---|---|---|
| 1 | Biscuit | dog | Beagle | 3 | 11.2 | false | 2026-01-14 |
| 2 | Mochi | cat | Siamese | 2 | 4.1 | true | 2025-11-02 |
| 3 | Pickles | dog | NULL | 7 | 24.5 | false | 2025-09-21 |
| 4 | Luna | cat | NULL | 5 | 3.8 | false | 2026-02-03 |
| 5 | Waffles | rabbit | Holland Lop | 1 | 1.6 | true | 2026-03-11 |
| 6 | Bruno | dog | Boxer | 9 | 30.1 | false | 2025-06-30 |
The fix returns, SQLite: first 6 of 20 rows
| id | name | species | breed | age | weight_kg | adopted | arrived_on |
|---|---|---|---|---|---|---|---|
| 1 | Biscuit | dog | Beagle | 3 | 11.2 | 0 | 2026-01-14 |
| 2 | Mochi | cat | Siamese | 2 | 4.1 | 1 | 2025-11-02 |
| 3 | Pickles | dog | NULL | 7 | 24.5 | 0 | 2025-09-21 |
| 4 | Luna | cat | NULL | 5 | 3.8 | 0 | 2026-02-03 |
| 5 | Waffles | rabbit | Holland Lop | 1 | 1.6 | 1 | 2026-03-11 |
| 6 | Bruno | dog | Boxer | 9 | 30.1 | 0 | 2025-06-30 |
Experiment with it: PostgreSQL playground·SQLite playground
Official documentation
Stop hitting this error
Practise the concept behind it in a five-minute lesson, or read the full guide: The SQL SELECT statement.