# 42703 — undefined_column

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

# 42703

## At a glance {#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.

<!-- BEGIN SQLSTATE FACTS: generated by scripts/generate.py; do not edit -->

| 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 | `—` |

<!-- source facts: data/errcodes/42703.json -->
<!-- END SQLSTATE FACTS -->

## Meaning {#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 {#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 {#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 {#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 {#case}

<!-- BEGIN SQLSTATE SNIPPET: undefined_column -->

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.

```sql
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;
```

<!-- END SQLSTATE SNIPPET -->

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`](../data/cases/42703.json) and [`authored evidence`](../data/evidence/42703.json). The runner manifest is `verify/cases/42703/cases.json`, and the page SQL is checked against its shared registry.

## Versions {#versions}

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

## Related {#related}

- [`42702` — ambiguous_column](../42702/)
- [`3F000` — related condition](../3f000/)

## Sources {#sources}

- `src.errcodes.18.6` — fixed `errcodes.txt` definition at commit `724edf9bde9d356724ad384a2e196edc3c9f80f7`; SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt)).
- `src.undefined-column.18.6` — `src/backend/parser/parse_relation.c` at `REL_18_6` commit `724edf9bde9d356724ad384a2e196edc3c9f80f7`; fixed blob SHA-256 `0d9c88f4a8def4c2d982c33f13208590e21ecf5e6f8cd9d7faa223dc771c9a9a` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_relation.c#L3854-L3859)).
- `src.undefined-column.10.23` — `src/backend/parser/parse_relation.c` at `REL_10_23` commit `02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4`; fixed blob SHA-256 `a34f40fc93fa5df0015fe5af5ee7761ccba2d16a791cda69ae07848ed27616b5` ([source](https://github.com/postgres/postgres/blob/02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4/src/backend/parser/parse_relation.c#L3327-L3331)).
- `src.calls.REL_18_6` / `src.calls.REL_10_23` — fixed call scans, SHA-256 `9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf` / `00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c`.
