sqlstreak

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.

Broken
SELECT * FROM pet;
Fixed
SELECT * FROM pets;

Use the exact table name. When in doubt, list the tables first.

The fix returns, PostgreSQL: first 6 of 20 rows

idnamespeciesbreedageweight_kgadoptedarrived_on
1BiscuitdogBeagle311.2false2026-01-14
2MochicatSiamese24.1true2025-11-02
3PicklesdogNULL724.5false2025-09-21
4LunacatNULL53.8false2026-02-03
5WafflesrabbitHolland Lop11.6true2026-03-11
6BrunodogBoxer930.1false2025-06-30

The fix returns, SQLite: first 6 of 20 rows

idnamespeciesbreedageweight_kgadoptedarrived_on
1BiscuitdogBeagle311.202026-01-14
2MochicatSiamese24.112025-11-02
3PicklesdogNULL724.502025-09-21
4LunacatNULL53.802026-02-03
5WafflesrabbitHolland Lop11.612026-03-11
6BrunodogBoxer930.102025-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.