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.

What lands in your log

ERROR: column "id" specified more than once

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

In 10 seconds

What triggers it
Write a CREATE TABLE that lists the same column name (here id) two times.
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.

Fix

What to do right now

Application-level steps for 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
DROP TABLE IF EXISTS reg_users;
CREATE TABLE reg_users (user_id int, email text);
SELECT attname FROM pg_attribute
WHERE attrelid = 'reg_users'::regclass AND attnum > 0
ORDER BY attnum;

Connected

Everything this error touches

Every page this SQLSTATE connects to: the concept that explains it, the runbooks that fix it, the parameters you tune to prevent it, and the sibling errors it travels with. All real cross-references. Jump straight in, or open the full interactive map.

Open in the interactive map →

Verification

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

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops