42712 — Duplicate alias
42712 — Duplicate alias
At a glance
42712 is duplicate_alias: a query namespace assigns the same table alias more than once. The parser rejects two VALUES range-table entries named duplicate_alias.
| Field | Value |
|---|---|
| SQLSTATE | 42712 |
| Condition | duplicate_alias |
| Status | active |
| Known present by | 7.4 |
| Locked snapshots | 9.0.23, 9.1.24, 9.2.24, 9.3.25, 9.4.26, 9.5.25, 9.6.24, 10.23, 11.22, 12.22, 13.23, 14.24, 15.19, 16.15, 17.11, 18.6, 19beta3 |
| Macros | ERRCODE_DUPLICATE_ALIAS |
| Aliases | — |
Meaning
Aliases are query names, so the second range-table entry is ambiguous before execution. This differs from a duplicate physical object (42710) and from repeated output column labels. Inspect every FROM/JOIN/CTE/subquery alias. The selected autocommit error leaves IDLE.
Diagnosis
Inspect every FROM, JOIN, CTE, and subquery alias, including aliases introduced by generated SQL. The duplicate is in the current query namespace, so search_path or renaming a base table is not the diagnosis.
Response
Give each range-table entry a distinct alias and qualify references. Renaming a base table or changing search_path does not repair the current query. In an explicit transaction, the failed parse leaves INERROR; roll back or return to a suitable savepoint before retrying. The selected autocommit path returns to IDLE.
Observed diagnostics
The fixed parser group is explicit ERROR with primary table name "%s" specified more than once and no detail or hint.
Representative case
The case uses two one-row VALUES relations with the same alias, then left_alias and right_alias, asserting both values.
The selected 18.6 and 10.21 runs passed SQLSTATE, severity, state/recovery, repair, cleanup, and isolated-target stop assertions. See case JSON and authored evidence; private manifest and registry hashes are recorded there.
Versions
The locked catalogue contains this condition from the 7.4 presence bound through the listed snapshots. The selected natural case passed on PostgreSQL 18.6 and 10.21; that bounded result does not infer every intermediate release or every source branch.
Related
Sources
src.errcodes.REL_18_6— fixed definition at724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-2566e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba(source).src.duplicate-alias.18.6—src/backend/parser/parse_relation.clines 471–474 at724edf9bde9d356724ad384a2e196edc3c9f80f7; blob SHA-2560d9c88f4a8def4c2d982c33f13208590e21ecf5e6f8cd9d7faa223dc771c9a9a(source).src.duplicate-alias.10.23—src/backend/parser/parse_relation.clines 417–420 at02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4; blob SHA-256a34f40fc93fa5df0015fe5af5ee7761ccba2d16a791cda69ae07848ed27616b5(source).src.calls.REL_18_6/src.calls.REL_10_23— fixed call scans, SHA-2569ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf/00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c.manifest.42712/snippet-registry.42712— hashes are recorded inevidence/42712.jsonand each runtime record.