Skip to content

42703 — undefined_column

PostgreSQL SQLSTATE 42703: undefined_column, source-backed diagnosis and recovery guidance.

42703

At a glance

SQLSTATE 42703 is undefined_column in Class 42. 42703 is undefined_column. The selected query names missing_column on a real table and reports column "%s" does not exist; selecting the defined id then succeeds.

Field Value
SQLSTATE 42703
Condition undefined_column
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_UNDEFINED_COLUMN
Aliases

Meaning

42703 is undefined_column. When a relation has been found but a referenced column is absent from the visible query scope, errorMissingColumn searches the range table for useful suggestions and raises ERROR column "%s" does not exist (or a qualified form when the relation was named). The selected query names missing_column on a real table and succeeds after changing to its defined id column.

Diagnosis

Check the exact relation, alias, search scope, quoted spelling/case, and migration version. If the parser finds a close candidate it may add a HINT, but the selected path has no hint. The parser reports the error before execution and leaves the autocommit session IDLE; inside an explicit BEGIN, it leaves the transaction INERROR until ROLLBACK or a suitable savepoint rollback before retrying. Distinguish a missing column from 42P01 (the unqualified relation is absent), 3F000 (the schema/creation namespace is absent), and 42702 (more than one visible column matches).

Response

Correct the column or migration and rerun against the intended relation. If the application supports multiple schemas or versions, qualify the relation and deploy the matching migration before retrying. A quoted identifier with different case is a different name; use the catalog or an introspection query to confirm the deployed spelling before changing application SQL.

Messages

The selected errorMissingColumn branch emits an explicit ERROR with primary column "%s" does not exist; %s is the unresolved column, and other source branches may add a suggestion HINT or use a qualified relation form. A client exception without the server SQLSTATE and primary is not sufficient to claim 42703.

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.column_table (id integer);
INSERT INTO syntax_schema.column_table VALUES (1);
SELECT missing_column FROM syntax_schema.column_table;
SELECT id FROM syntax_schema.column_table;

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 42703 case JSON and authored evidence. The runner manifest is verify/cases/42703/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.undefined-column.18.6src/backend/parser/parse_relation.c at REL_18_6 commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; fixed blob SHA-256 0d9c88f4a8def4c2d982c33f13208590e21ecf5e6f8cd9d7faa223dc771c9a9a (source).
  • src.undefined-column.10.23src/backend/parser/parse_relation.c at REL_10_23 commit 02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4; fixed blob SHA-256 a34f40fc93fa5df0015fe5af5ee7761ccba2d16a791cda69ae07848ed27616b5 (source).
  • src.calls.REL_18_6 / src.calls.REL_10_23 — fixed call scans, SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf / 00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c.