42703ERRORTier 1 — Safe✅ HIGH confidencecolumn does not exist
What this means
The query parser found the referenced table but could not locate a column with the given name in that table's attribute list. Like 42P01, this is a parse-time error caught before any data is touched.
Why it happens
- 1Misspelled column name in SELECT, WHERE, ORDER BY, or JOIN condition
- 2Column was renamed with ALTER TABLE RENAME COLUMN but queries were not updated
- 3Column exists in a different table that is not in scope for the query
- 4Column name was double-quoted during creation (case-sensitive) but referenced in lowercase
- 5Referencing a column alias defined in SELECT from within a WHERE clause (not yet in scope)
How to reproduce
A SELECT query references a column name that does not exist on the table.
CREATE TABLE products (
id SERIAL PRIMARY KEY,
title TEXT NOT NULL
);
SELECT product_name FROM products; -- "title" exists, not "product_name"Fix 1: Inspect table columns and correct the name
When the column exists under a different name or casing.
SELECT column_name, data_type
FROM information_schema.columns
WHERE table_name = 'products'
ORDER BY ordinal_position;
-- Use the correct column name
SELECT title FROM products;Why this works
The parser resolves column references by scanning the RTE (range table entry) attribute list built from pg_attribute. information_schema.columns is a view over pg_attribute and shows the canonical stored names including their case as created.
What not to do
Use SELECT * to avoid specifying column names
Why it's wrong: Masks the schema and makes queries fragile to future column additions or removals; does not fix the underlying naming issue.
Sources
📚 Official docs: https://www.postgresql.org/docs/current/errcodes-appendix.html
📚 Feature docs: https://www.postgresql.org/docs/current/sql-select.html
🔧 Source ref: src/backend/parser/parse_relation.c — scanRTEForColumn()
Confidence assessment
✅ HIGH confidence
Stable and well-understood. Column resolution is handled entirely at parse time. Edge case: using a SELECT-list alias in the WHERE clause produces this error because WHERE is evaluated before SELECT in the logical processing order.
See also
🔗 Related errors
📄 Reference pages