42710 — Duplicate object
42710 — Duplicate object
At a glance
42710 is duplicate_object: a definition collides with an occupied object name. The selected path is a second CREATE TYPE ... AS ENUM; the same SQLSTATE is reused by other object-definition paths, so first identify the object kind and schema.
| Field | Value |
|---|---|
| SQLSTATE | 42710 |
| Condition | duplicate_object |
| 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_OBJECT |
| Aliases | — |
Meaning
The DefineEnum path reports type "%s" already exists; this is a catalog-definition collision, not a row-level unique violation. CREATE OR REPLACE is not a universal repair. Inspect pg_type joined to pg_namespace, ownership, and migration order. The selected autocommit error leaves IDLE; an explicit transaction must be rolled back before more commands.
Diagnosis
Inspect the exact object kind and schema first. For a type, query pg_type joined to pg_namespace; for a relation use to_regclass, and for a routine inspect pg_proc and pg_get_function_identity_arguments. Check ownership and migration order.
Response
Choose an intentionally free name, or use an object-specific alter/replace operation only when the existing owner is yours. The case repairs by creating a distinct ENUM. A preflight check does not remove a concurrent-create race, and dropping an unknown object is unsafe. In an explicit transaction, the failed definition leaves INERROR; roll back or return to a suitable savepoint before retrying. The selected autocommit case remains IDLE.
Observed diagnostics
CREATE TYPE in this ENUM branch has explicit ERROR severity and no hint; other 42710 branches have different templates, including a heap.c relation/type hint that does not belong here.
Representative case
This disposable case creates an ENUM, repeats its definition, checks the code and state, then creates a distinct type and verifies both catalog entries.
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-enum.18.6—src/backend/commands/typecmds.clines 1219–1221 at724edf9bde9d356724ad384a2e196edc3c9f80f7; blob SHA-25660d1e9754646e100f6b74aa367ad8c2c52386c400df721707423d329209c47eb(source).src.duplicate-enum.10.23—src/backend/commands/typecmds.clines 1139–1141 at02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4; blob SHA-256fa1dfb766f7a3117eb677461ede774d5ba7c25324cbbd2a200435fa9c9c8e863(source).src.calls.REL_18_6/src.calls.REL_10_23— fixed call scans, SHA-2569ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf/00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c.manifest.42710/snippet-registry.42710— hashes are recorded inevidence/42710.jsonand each runtime record.