InletDownload

PostgreSQL error 42703

column does not exist

PostgreSQL can’t find a column by that name in the tables your query can see. Most often a string was written in double quotes, which PostgreSQL reads as a column name; otherwise it’s a typo, a capitalised name, or an alias used where it doesn’t exist yet.

ERROR:  column "active" does not exist

Tested on PostgreSQL 18.6 (also 14–17) · Updated 9 October 2026

What it means

The server checked every column name in your statement against the tables in its FROM clause (or the table you’re inserting into or updating) and one of them matched nothing. The statement didn’t run. The caret under LINE 1 points at the name.

When there’s a column with a similar name, PostgreSQL adds a hint, which is usually the fix:

HINT:  Perhaps you meant to reference the column "customers.email".

Common causes

  1. A string in double quotes. In PostgreSQL, "active" is a column name and 'active' is a string. WHERE status = "active" looks for a column called active. This catches people coming from MySQL, which accepts both by default.
  2. A typo, or a column that was renamed or never added (a migration that didn’t run on this database).
  3. Capitals in the name. A column created as "FirstName" must always be written "FirstName"; an unquoted FirstName is folded to firstname.
  4. An output alias used too early. An alias from the SELECT list (AS gross) doesn’t exist yet in WHERE or HAVING. ORDER BY and GROUP BY accept the bare alias (ORDER BY gross), but not an expression built on it (ORDER BY gross + 1).
  5. The wrong table alias: c.total when total is on invoices i, or a column from a table that isn’t in this part of the query.
  6. A qualified column in UPDATE … SET. SET c.email = … is read as a field email inside a column c.

How to fix it

Use single quotes for values

SELECT * FROM customers WHERE status = 'active';

Double quotes are only for names: "FirstName", "order". A value containing an apostrophe doubles it: 'O''Brien'.

Check the real column names

SELECT column_name, data_type
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = 'customers'
ORDER BY ordinal_position;

In psql, \d customers shows the same. If a name in the list has capitals or spaces, quote it exactly as shown. If the column isn’t there at all, check you’re on the right database and that the migration which adds it has run.

Repeat the expression instead of the alias

-- fails: gross doesn't exist yet when WHERE runs
SELECT total * 1.2 AS gross FROM invoices WHERE gross > 100;

-- works
SELECT total * 1.2 AS gross FROM invoices WHERE total * 1.2 > 100;

-- or name it in a subquery first
SELECT * FROM (SELECT total * 1.2 AS gross FROM invoices) t WHERE gross > 100;

Qualify columns with the right alias

Once a table has an alias, use the alias: FROM customers c means c.email works and customers.email fails with invalid reference to FROM-clause entry for table "customers". In a join, prefix each column with the alias of the table it’s on; the hint, when there is one, names it.

Don’t qualify SET targets

UPDATE customers c SET email = 'b@example.com' WHERE c.id = 1;

The table alias is fine in WHERE and FROM, never on the left of = in SET.

Reproduce it

On PostgreSQL 18.6:

CREATE TABLE customers (id int PRIMARY KEY, email text, status text, "FirstName" text);
CREATE TABLE invoices (id int PRIMARY KEY, customer_id int REFERENCES customers, total numeric);

SELECT * FROM customers WHERE status = "active";
ERROR:  column "active" does not exist
LINE 1: SELECT * FROM customers WHERE status = "active";
                                               ^

A typo, and a capitalised name, both get a hint:

ERROR:  column "emial" does not exist
LINE 1: SELECT emial FROM customers;
               ^
HINT:  Perhaps you meant to reference the column "customers.email".

ERROR:  column "firstname" does not exist
LINE 1: SELECT FirstName FROM customers;
               ^
HINT:  Perhaps you meant to reference the column "customers.FirstName".

The wrong alias in a join:

ERROR:  column c.total does not exist
LINE 1: SELECT c.total FROM customers c JOIN invoices i ON i.custome...
               ^
HINT:  Perhaps you meant to reference the column "i.total".

An alias in WHERE (HAVING spent > 100 fails the same way), and a misspelt column in an INSERT list:

ERROR:  column "gross" does not exist
LINE 1: SELECT total * 1.2 AS gross FROM invoices WHERE gross > 100;
                                                        ^

ERROR:  column "mail" of relation "customers" does not exist
LINE 1: INSERT INTO customers (id, mail) VALUES (1, 'a@example.com')...
                                   ^

A column used where it can’t be referenced, here inside VALUES:

ERROR:  column "customer_id" does not exist
LINE 1: ...O invoices (id, customer_id, total) VALUES (1, 1, customer_i...
                                                             ^
DETAIL:  There is a column named "customer_id" in table "invoices", but it cannot be referenced from this part of the query.

The last line is a HINT on PostgreSQL 14 and 15 and a DETAIL from 16. A qualified SET target:

ERROR:  column "c" of relation "customers" does not exist
LINE 1: UPDATE customers c SET c.email = 'b@example.com' WHERE id = ...
                               ^
HINT:  SET target columns cannot be qualified with the relation name.

That hint appears from PostgreSQL 17; 14 to 16 print the error alone.

In Inlet

The query editor completes column names from the live schema, so you pick names that exist rather than typing them. When a statement fails, Inlet shows the error at the position the server reports, with a hint for common ones. With your own Anthropic API key, Ask Claude (⌘L) can fix the failed statement; it sends the schema, the SQL and the error, never rows.

Related

Sources