Skip to content

42611 — invalid_column_definition

PostgreSQL SQLSTATE 42611: invalid_column_definition, source-backed diagnosis and recovery guidance.

42611

At a glance

SQLSTATE 42611 is invalid_column_definition in Class 42. 42611 is an invalid column definition. Two inherited parents in the selected case define different defaults for id; the child definition fails with column "%s" inherits conflicting default values and the hint to specify a default explicitly.

Field Value
SQLSTATE 42611
Condition invalid_column_definition
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_INVALID_COLUMN_DEFINITION
Aliases

Meaning

42611 is an invalid column definition. During MergeAttributes, PostgreSQL merges parent columns left to right. If equal-named inherited columns have non-equal default expressions, the merge marks the default as conflicting; unless the child overrides it, the final check raises ERROR column "%s" inherits conflicting default values with the hint to specify a default explicitly. Two inherited parents in the selected case define different defaults for id.

Diagnosis

Inspect every parent in the INHERITS list and compare the equal-named columns’ type, collation, nullability, and default expressions. A matching default can merge; a child-local default overrides the inherited conflict. The selected DDL ERROR leaves the autocommit session IDLE; this is the inherited-default branch, not a generic duplicate-column error or a type/collation conflict.

Response

Declare the intended child default explicitly, as the server hint says, then insert DEFAULT VALUES and verify the result. If the parent definitions are supposed to agree, repair the migration at the parents instead; if they intentionally differ, keep the child override visible in the DDL. The selected repair returns 1, but that value is case-specific and does not choose a universal policy.

Messages

The selected source branch emits an explicit ERROR with primary column "%s" inherits conflicting default values and HINT To resolve the conflict, specify a default explicitly. %s is the conflicting column name. A client exception without the server SQLSTATE, primary, and HINT is not sufficient to identify this selected inherited-default subpath; other fixed producers can use the same SQLSTATE with different diagnostics.

Representative case

The page uses the same statements as the runner registry. Generated names such as syntax_schema and syntax_role are replaced by disposable runner values when executed.

CREATE TABLE syntax_schema.parent_one (id integer DEFAULT 1);
CREATE TABLE syntax_schema.parent_two (id integer DEFAULT 2);
CREATE TABLE syntax_schema.child_bad () INHERITS (syntax_schema.parent_one, syntax_schema.parent_two);
CREATE TABLE syntax_schema.child_good (id integer DEFAULT 1) INHERITS (syntax_schema.parent_one, syntax_schema.parent_two);
INSERT INTO syntax_schema.child_good DEFAULT VALUES RETURNING id;

The selected 18.6 run reports the structured diagnostic and passes the repair assertions; the 10.21 run passes the same case-specific checks. The downloadable case and evidence projections are 42611 case JSON and authored evidence. The runner manifest is verify/cases/42611/cases.json, and the page SQL is checked against its shared registry.

Versions

The selected natural runtime scope is PostgreSQL 18.6 and 10.21; it does not infer behavior for every intermediate release.

Sources

  • src.errcodes.18.6 — fixed errcodes.txt definition at commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba (source).
  • src.inherited-conflicting-default.18.6src/backend/commands/tablecmds.c at REL_18_6 commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; fixed blob SHA-256 422dc8e833df4940755973c757e338295822ba3e4c7266c40669f49f96eb15a9 (source).
  • src.inherited-conflicting-default.10.23src/backend/commands/tablecmds.c at REL_10_23 commit 02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4; fixed blob SHA-256 6de441c88496c6cf57a836898388085ec08bf69afd70d07acdafd6089b9b5f8c (source).
  • src.calls.REL_18_6 / src.calls.REL_10_23 — fixed call scans, SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf / 00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c.