sqlstreak

SQL error

column "cat" does not exist (double quotes vs single quotes)

Updated · Tested on PostgreSQL 18.6 and SQLite 3.54.1 (results generated , re-checked on every release)

Short answer

In SQL, single quotes mean text and double quotes mean a column or table name. WHERE species = "cat" asks for a column named cat. Write WHERE species = 'cat'.

The exact messages

  • PostgreSQLERROR: column "cat" does not exist
  • SQLiteNo error, but a silent surprise: see below.

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:  column "cat" does not exist
LINE 2: WHERE species = "cat";
                        ^

Why it happens

Double quotes around a text value

The most common cause, especially for people coming from JavaScript or Python where both quote styles mean a string.

A typo in a real column name

If the name in quotes is meant to be a column, check its spelling against the table.

A column created with capitals in quotes

CREATE TABLE t ("Name" text) creates a case-sensitive column. You must then always write "Name"; plain name won't find it. Prefer lowercase names without quotes.

Reproduce it, then fix it

Both queries run on a real database in your browser. Switch dialects to compare.

Broken
SELECT name FROM pets
WHERE species = "cat";
Fixed
SELECT name FROM pets
WHERE species = 'cat';

Single quotes make 'cat' a text value, so the comparison works in every database.

The fix returns, PostgreSQL: first 6 of 7 rows

name
Mochi
Luna
Pepper
Tofu
Socks
Olive

The fix returns, SQLite: first 6 of 7 rows

name
Mochi
Luna
Pepper
Tofu
Socks
Olive

Experiment with it: PostgreSQL playground·SQLite playground

What SQLite does instead

SQLite runs it: when no column called cat exists, it falls back to treating "cat" as text. That legacy quirk makes the query work by accident, and it silently changes meaning the day someone adds a column with that name.

Official documentation

Stop hitting this error

Practise the concept behind it in a five-minute lesson, or read the full guide: SQL WHERE clause: filtering rows.