42P16
Read PG 18 manual ↗invalid_table_definition
- SQLSTATE
- 42P16
- Condition name
- invalid_table_definition
- Class
- Syntax Error or Access Rule Violation
- Source macro
- ERRCODE_INVALID_TABLE_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
42P16 (invalid_table_definition) A table definition can violate partition-key, collation, or primary-key rules.
Meaning
Table-definition checks use this condition for several relation-shape violations. Core 18.6 examples reject pseudo-types in partition keys, missing collation for a collatable partition key, and multiple primary keys.
Diagnosis
Use the exact message to identify the table and column. Inspect pg_attribute/pg_type for the partition key type, determine the collation explicitly for collatable types, and list existing primary constraints before changing DDL.
Response
Change only the conflicting table definition: use a supported concrete partition-key type, add an explicit COLLATE where the source requires it, or retain one intended primary key and remove the duplicate declaration from the migration. If this ERROR occurs inside an explicit transaction, ROLLBACK or ROLLBACK TO a pre-error savepoint before issuing the corrected DDL; do not keep sending table changes in the aborted transaction.
Messages
Representative source messages include: message: partition key column %s has pseudo-type %s; message: no collation was derived for partition key column %s with collatable type %s; HINT: Use the COLLATE clause to set the collation explicitly.; message: multiple primary keys for table "%s" are not allowed. 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:576-580(fixed source)src/backend/catalog/heap.c:697-702(fixed source)src/backend/catalog/index.c:218-221(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.
42P16 is the invalid_table_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.
Table-definition checks use this condition for several relation-shape violations. Core 18.6 examples reject pseudo-types in partition keys, missing collation for a collatable partition key, and multiple primary keys.
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.42P16.af3eab51674420e4a935dec6 src.call.42P16.ba3688fe3791594da97fde08 src.call.42P16.ca2b8fc15fc050d4a6cd2d3b
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 397
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/catalog/heap.c · REL_18_6 · lines 576-580
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/catalog/heap.c · REL_18_6 · lines 697-702
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/catalog/index.c · REL_18_6 · lines 218-221
724edf9bde9d356724ad384a2e196edc3c9f80f7 raw/calls/REL_18_6.jsonl· ·
Message templates
ERROR · message.variant-1
Primary
partition key column %s has pseudo-type %s
Placeholders remain dynamic source fields; no concrete runtime value is claimed.
ERROR · message.variant-2
Primary
no collation was derived for partition key column %s with collatable type %s
Hint
Use the COLLATE clause to set the collation explicitly.
Primary
Use the COLLATE clause to set the collation explicitly.
Placeholders remain dynamic source fields; no concrete runtime value is claimed.
ERROR · message.variant-3
Primary
multiple primary keys for table "%s" are not allowed
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:d08af379a7e0c44bd47f919e941… · English manual source