SQLSTATE 42701Severity lowLab verified

Incident brief

Column specified more than once

A CREATE TABLE listed the same column name twice. PostgreSQL refuses to build a table that has two columns with the same name.

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 specified more than once
What triggers it
Write a CREATE TABLE that lists the same column name (here id) two times.
The fix
Give every column a distinct name (here, rename the second id to user_id).
Proof
Reproduced on PostgreSQL 16.14 → A CREATE TABLE that listed id twice was rejected with SQLSTATE 42701 (duplicate_column). No table was created and the session stayed usable.

The fix

What to do right now

The immediate, application-level response to this error.

  • Give every column a distinct name (here, rename the second id to user_id).
  • When generating DDL programmatically, de-duplicate the column list before emitting CREATE TABLE.
  • Watch for a column that collides with one pulled in by LIKE or INHERITS — the merge rules can surface the same name.
Fix — SQL
-- every column has a distinct name
CREATE TABLE reg_users (user_id int, email text);

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