SQLSTATE 42702Severity lowLab verified

Incident brief

Column reference is ambiguous

A query referenced a bare column name that exists in more than one table in the FROM clause, so PostgreSQL could not tell which table you meant.

Reproduced on PostgreSQL 16.14Verified 2026-07-19 (isolated lab, PostgreSQL 16.14)Reviewed by Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What
Column reference is ambiguous
What triggers it
Create two tables that share a column name (here both have id and name).
The fix
Qualify the column with its table name or alias (employees.id, or e.id).
Proof
Reproduced on PostgreSQL 16.14 → Selecting the bare column id from a USING (name) join of two tables that both have an id column was rejected with SQLSTATE 42702. Qualifying the column resolved it.

The fix

What to do right now

The immediate, application-level response to this error.

  • Qualify the column with its table name or alias (employees.id, or e.id).
  • If the column is a shared join key, list it in USING (...) so the join merges it into a single output column.
  • Give tables short aliases and always qualify shared column names in multi-table queries.
Fix — SQL
-- qualify the column so PostgreSQL knows which table's id you mean
SELECT e.id, e.name
FROM employees e
JOIN departments d ON e.id = d.id;

Related & next steps

Follow the thread

Everything this error touches — jump straight to the sibling error, term, runbook, or parameter.

Verification

PG 16.14
Last verified
2026-07-19 (isolated lab, PostgreSQL 16.14)
Reviewed by
Verified against PostgreSQL 16.14 in an isolated lab environment
Audit status
reviewed