select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

SQLSTATE / CLASS 42 · SYNTAX ERROR OR ACCESS RULE VIOLATION

invalid_column_definition

SQLSTATE
42611
Condition name
invalid_column_definition
Class
Syntax Error or Access Rule Violation
Source macro
ERRCODE_INVALID_COLUMN_DEFINITION
Evidence
Observed at runtime in the source evidence
Analysis & operational context

English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗

<h1>42611</h1>

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.

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.

Source evidence

Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.

42611 is the invalid_column_definition condition in Class 42.

Method: Read fixed errcodes.txt and the locked catalogue metadata.

Limits: Directory identity does not identify every backend path.

src.errcodes.18.6

The fixed source calls for 42611 include the mechanism and message boundary selected for this page.

Method: Trace the resolved REL_18_6 and REL_10_23 source call records at the locked commits.

Limits: Other calls can use the same SQLSTATE with different context or dynamic fields.

src.inherited-conflicting-default.18.6 src.inherited-conflicting-default.10.23

The selected conflicting_inherited_default case passed on isolated PostgreSQL 18.6 and 10.21 targets.

Method: Run the shared registry case and inspect structured diagnostics, state/recovery assertions, and cleanup.

Limits: This covers the selected case and targets only; it does not generalize to all drivers or intermediate releases.

manifest.42611 snippet-registry.42611

The locked catalogue records 42611; runtime scope is limited to the selected targets.

Method: Read generated facts and selected summaries.

Limits: Definition presence is not an exact behavioral introduction.

src.errcodes.18.6 src.calls.REL_18_6 src.calls.REL_10_23

Message templates

explicit ERROR · message.inherited-default

Primary

column "%s" inherits conflicting default values

Hint

To resolve the conflict, specify a default explicitly.

Reproduction & repair cases

conflicting_inherited_default · PG 10, 18

Preconditions

  • A runner-owned disposable target is provisioned.

Trigger: Create two parent tables with different defaults and inherit both without an explicit child default.

Expected assertions

  • SQLSTATE is 42611 with the conflicting-default diagnostic
  • The session remains IDLE
  • An explicit child default resolves the inheritance conflict and DEFAULT inserts 1

Repair: Specify the intended default explicitly on the child definition, then verify the inherited table.

Cleanup: Drop the case schema with an owner connection.

Recorded runtime evidence

18.6 (Homebrew) · passed

Run: 42611-syntax-latest1

{
  "diagnostic": {
    "text": "column \"id\" inherits conflicting default values\nHINT:  To resolve the conflict, specify a default explicitly.",
    "context": null,
    "severity": "ERROR",
    "sqlstate": "42611",
    "table_name": null,
    "column_name": null,
    "schema_name": null,
    "source_file": "tablecmds.c",
    "source_line": "3148",
    "message_hint": "To resolve the conflict, specify a default explicitly.",
    "datatype_name": null,
    "exception_type": "InvalidColumnDefinition",
    "internal_query": null,
    "message_detail": null,
    "constraint_name": null,
    "message_primary": "column \"id\" inherits conflicting default values",
    "source_function": "MergeAttributes",
    "internal_position": null,
    "statement_position": null,
    "severity_nonlocalized": "ERROR"
  },
  "repair_value": 1,
  "failed_status": "IDLE",
  "repair_status": "IDLE",
  "connection_autocommit": true
}
10.21 (Debian 10.21-1.pgdg90+1) · passed

Run: 42611-syntax-pg10

{
  "diagnostic": {
    "text": "column \"id\" inherits conflicting default values\nHINT:  To resolve the conflict, specify a default explicitly.",
    "context": null,
    "severity": "ERROR",
    "sqlstate": "42611",
    "table_name": null,
    "column_name": null,
    "schema_name": null,
    "source_file": "tablecmds.c",
    "source_line": "2292",
    "message_hint": "To resolve the conflict, specify a default explicitly.",
    "datatype_name": null,
    "exception_type": "InvalidColumnDefinition",
    "internal_query": null,
    "message_detail": null,
    "constraint_name": null,
    "message_primary": "column \"id\" inherits conflicting default values",
    "source_function": "MergeAttributes",
    "internal_position": null,
    "statement_position": null,
    "severity_nonlocalized": "ERROR"
  },
  "repair_value": 1,
  "failed_status": "IDLE",
  "repair_status": "IDLE",
  "connection_autocommit": true
}

Definition snapshot: english-manuals:6295440ccdb4e3cd31aa05c5ced… · English manual source