42P17
Read PG 18 manual ↗invalid_object_definition
- SQLSTATE
- 42P17
- Condition name
- invalid_object_definition
- Class
- Syntax Error or Access Rule Violation
- Source macro
- ERRCODE_INVALID_OBJECT_DEFINITION
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
42P17 (invalid_object_definition) Object definitions can conflict through inheritance, generated columns, or rewrite rules.
Meaning
Object-definition validation covers object relationships and generated/rule definitions. Selected paths reject an inherited constraint conflict, a generated column referencing another generated column, and recursive rules.
Diagnosis
Classify the object named in the message: relation inheritance, generated-column expression, or rewrite rule. Inspect pg_inherits and constraint inheritance, the full generated expression, or pg_rewrite rules; these paths require different repairs.
Response
For an inherited-constraint conflict, compare the parent/child definitions and inheritance flags and align them with the intended inheritance contract; do not universally remove an inherited constraint. Make a generated expression depend only on permitted base columns, or break the rewrite-rule cycle. Recheck the resulting object graph before rerunning DDL; renaming alone does not repair a recursive rule. If an ERROR occurs inside an explicit transaction, ROLLBACK or ROLLBACK TO a pre-error savepoint before another DDL attempt.
Messages
Representative source messages include: message: constraint "%s" conflicts with non-inherited constraint on relation "%s"; message: cannot use generated column "%s" in column generation expression; DETAIL: A generated column cannot reference another generated column.; message: infinite recursion detected in rules for relation "%s". Placeholders are filled by the actual object, column, or parameter.
Versions
The locked catalogue shows this condition by PostgreSQL 7.4; behavior here is fixed to PostgreSQL 18.6 source. Catalogue presence is a range boundary, not proof that every message or feature began in that release.
Sources
Source messages, line anchors, and evidence limits are recorded in authored evidence.
src/backend/catalog/heap.c:2820-2823(fixed source)src/backend/catalog/heap.c:3237-3242(fixed source)src/backend/rewrite/rewriteHandler.c:2164-2167(fixed source)
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
42P17 is the invalid_object_definition condition in Class 42.
Method: Read fixed REL_18_6 errcodes.txt and locked facts.
Limits: Identity does not enumerate all source branches or client failures.
Selected paths reject an inherited-constraint conflict whose parent/child inheritance flags do not permit the requested merge, a generated column referencing another generated column, and recursive rewrite rules. These object graphs require different repairs; the source does not support a universal remove-inherited-constraint rule.
Method: Read selected resolved REL_18_6 report groups and message roles.
Limits: Representative confirmed core paths only; not exhaustive historical or extension coverage.
src.call.42P17.7a6be8fbd1213811e253e016 src.call.42P17.09eb0354822f0636e23d3677 src.call.42P17.79a0f8a4009c621f6b3254f8
Locked catalogue snapshots show this condition by PostgreSQL 7.4; source behavior here is fixed at PostgreSQL 18.6.
Method: Read locked catalogue facts and definition snapshot.
Limits: First observed release is a lower bound, not precise behavioral introduction.
- src/backend/utils/errcodes.txt · REL_18_6 · line 398
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/catalog/heap.c · REL_18_6 · lines 2820-2823
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/catalog/heap.c · REL_18_6 · lines 3237-3242
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/rewrite/rewriteHandler.c · REL_18_6 · lines 2164-2167
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·
Message templates
ERROR · message.variant-1
Primary
constraint "%s" conflicts with non-inherited constraint on relation "%s"
Placeholders remain dynamic source fields; no concrete runtime value is claimed.
ERROR · message.variant-2
Primary
cannot use generated column "%s" in column generation expression
Detail
A generated column cannot reference another generated column.
Primary
A generated column cannot reference another generated column.
Placeholders remain dynamic source fields; no concrete runtime value is claimed.
ERROR · message.variant-3
Primary
infinite recursion detected in rules for relation "%s"
Placeholders remain dynamic source fields; no concrete runtime value is claimed.
Reproduction & repair cases
No reproduction case is attached to this condition.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:0dc90c3689900e64068ddbbcd23… · English manual source