PostgreSQL: ERROR: column "x" does not exist
PostgreSQL can’t find the column — a missing migration, a case-sensitive quoted name, or a string literal written in double quotes.
Seen on:
PostgreSQL
Meaning
Two PostgreSQL-specific traps cause most of these: unquoted identifiers are folded to lower case (a column created as "createdAt" must always be quoted), and double quotes mean *identifier*, not string — WHERE status = "paid" looks for a column named paid.
Common causes
- String value in double quotes (
"paid"instead of'paid') - Mixed-case column created with quotes, queried without (
createdAt→createdat) - Migration adding the column not run
- Column alias used in WHERE (aliases only exist in ORDER BY/outer query)
⚡ Quick fix
- Use single quotes for strings
- Quote mixed-case names exactly (
"createdAt") — or rename columns to snake_case - Run pending migrations
- Move alias-based filters into a subquery or repeat the expression
Detailed fix by platform
PostgreSQL
- Common mistakes:sql
SELECT * FROM orders WHERE status = "paid"; -- ❌ column "paid" does not exist SELECT * FROM orders WHERE status = 'paid'; -- ✅ SELECT "createdAt" FROM users; -- ✅ if the column was created with quotes \d users -- psql: list real column names
How to diagnose
- Quotes — Double quotes around a value?
- Case — How is the column really named (\d table)?
- Migrations — Run on this database?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026