↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / SQLSTATE

42703 — undefined_column

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

English manual coverage begins with PostgreSQL 8.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

aliases
Unknown
class name
Syntax Error or Access Rule Violation
condition name
undefined_column
lang
en
sqlstate
42703

Definition PG 18

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.

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}

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 {#versions}

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

Related {#related}

Sources {#sources}

  • src.errcodes.18.6 — fixed errcodes.txt definition at commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba (source).
  • src.undefined-column.18.6 — src/backend/parser/parse_relation.c at REL_18_6 commit 724edf9bde9d356724ad384a2e196edc3c9f80f7; fixed blob SHA-256 0d9c88f4a8def4c2d982c33f13208590e21ecf5e6f8cd9d7faa223dc771c9a9a (source).
  • src.undefined-column.10.23 — src/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.

Compare versions

SQLSTATE evidence and recorded runtime versions

cases · undefined_column
{
  "assertions": [
    "SQLSTATE is 42703 with the undefined-column diagnostic",
    "The session remains IDLE",
    "Selecting the defined id column succeeds"
  ],
  "case_id": "undefined_column",
  "cleanup": "Drop the case schema with an owner connection.",
  "has_snippet": true,
  "position": 0,
  "preconditions": [
    "A runner-owned disposable target is provisioned."
  ],
  "repair": "Correct the column name or migration, then rerun the query against the intended relation.",
  "trigger": "Select a column name that is absent from a real table.",
  "versions": [
    "10",
    "18"
  ]
}
claims · identity.class-and-condition
{
  "claim_id": "identity.class-and-condition",
  "limits": "Directory identity does not identify every backend path.",
  "method": "Read fixed errcodes.txt and the locked catalogue metadata.",
  "position": 0,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6"
  ],
  "statement": "42703 is the undefined_column condition in Class 42."
}
claims · mechanism.backend-path
{
  "claim_id": "mechanism.backend-path",
  "limits": "Other calls can use the same SQLSTATE with different context or dynamic fields.",
  "method": "Trace the resolved REL_18_6 and REL_10_23 source call records at the locked commits.",
  "position": 1,
  "runtime": [],
  "sources": [
    "src.undefined-column.18.6",
    "src.undefined-column.10.23"
  ],
  "statement": "The fixed source calls for 42703 include the mechanism and message boundary selected for this page."
}
claims · runtime.representative-case
{
  "claim_id": "runtime.representative-case",
  "limits": "This covers the selected case and targets only; it does not generalize to all drivers or intermediate releases.",
  "method": "Run the shared registry case and inspect structured diagnostics, state/recovery assertions, and cleanup.",
  "position": 2,
  "runtime": [
    "runtime.42703-syntax-latest2.latest",
    "runtime.42703-syntax-pg10.pg10"
  ],
  "sources": [
    "manifest.42703",
    "snippet-registry.42703"
  ],
  "statement": "The selected undefined_column case passed on isolated PostgreSQL 18.6 and 10.21 targets."
}
claims · versions.catalogue-boundary
{
  "claim_id": "versions.catalogue-boundary",
  "limits": "Definition presence is not an exact behavioral introduction.",
  "method": "Read generated facts and selected summaries.",
  "position": 3,
  "runtime": [],
  "sources": [
    "src.errcodes.18.6",
    "src.calls.REL_18_6",
    "src.calls.REL_10_23"
  ],
  "statement": "The locked catalogue records 42703; runtime scope is limited to the selected targets."
}
messages · message.undefined-column
{
  "limits": "",
  "message_id": "message.undefined-column",
  "path": "",
  "position": 0,
  "raw": {
    "id": "message.undefined-column",
    "primary_template": "column \"%s\" does not exist",
    "severity_source": "explicit ERROR",
    "sources": [
      "src.undefined-column.18.6",
      "src.undefined-column.10.23"
    ],
    "sqlstate": "42703"
  },
  "severity": "explicit ERROR",
  "sources": [
    "src.undefined-column.18.6",
    "src.undefined-column.10.23"
  ],
  "templates": [
    {
      "kind": "primary",
      "literal": "column \" \" does not exist",
      "position": 0,
      "role": "",
      "template": "column \"%s\" does not exist"
    }
  ]
}
runtimes · runtime.42703-syntax-latest2.latest · 18.6 (Homebrew) · passed
{
  "cases": [],
  "limits": "",
  "position": 0,
  "raw": {
    "assertions": [
      {
        "expected": "42703",
        "name": "42703 SQLSTATE",
        "observed": "42703",
        "passed": true
      },
      {
        "expected": "ERROR",
        "name": "42703 ERROR severity",
        "observed": "ERROR",
        "passed": true
      },
      {
        "expected": "column \"missing_column\" does not exist",
        "name": "42703 primary diagnostic",
        "observed": "column \"missing_column\" does not exist",
        "passed": true
      },
      {
        "expected": "IDLE",
        "name": "undefined column leaves session usable",
        "observed": "IDLE",
        "passed": true
      },
      {
        "expected": {
          "status": "IDLE",
          "value": 1
        },
        "name": "existing column repairs query",
        "observed": {
          "status": "IDLE",
          "value": 1
        },
        "passed": true
      }
    ],
    "case_manifest": {
      "id": "manifest.42703",
      "kind": "local_artifact",
      "path": "verify/cases/42703/cases.json",
      "sha256": "8034d1005edbc6093102a8e634bea65d7382b9061841da6bf781943a240caabb",
      "source_role": "case_manifest"
    },
    "cleanup": {
      "errors": [],
      "passed": true
    },
    "environment": {
      "TimeZone": "Asia/Shanghai",
      "backend_pid": 3011,
      "binary": {
        "bindir": "/opt/homebrew/Cellar/postgresql@18/18.6/bin",
        "pg_config": "/opt/homebrew/bin/pg_config",
        "pg_config_version": "PostgreSQL 18.6 (Homebrew)",
        "postgres": "/opt/homebrew/Cellar/postgresql@18/18.6/bin/postgres"
      },
      "connection_scope": "runner-owned localhost port",
      "current_user": "runner",
      "docker": {},
      "lc_messages": "C",
      "libpq_version": "18.6",
      "locale": "en_US.UTF-8",
      "log_destination": "csvlog,jsonlog",
      "log_error_verbosity": "verbose",
      "log_min_error_statement": "error",
      "log_min_messages": "error",
      "logging_collector": "on",
      "machine": "arm64",
      "max_connections": "100",
      "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
      "psycopg_version": "3.3.5",
      "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
      "server_encoding": "UTF8",
      "server_version": "18.6 (Homebrew)",
      "server_version_num": "180006",
      "target_kind": "latest",
      "wal_level": "logical"
    },
    "id": "runtime.42703-syntax-latest2.latest",
    "observed": {
      "connection_autocommit": true,
      "diagnostic": {
        "column_name": null,
        "constraint_name": null,
        "context": null,
        "datatype_name": null,
        "exception_type": "UndefinedColumn",
        "internal_position": null,
        "internal_query": null,
        "message_detail": null,
        "message_hint": null,
        "message_primary": "column \"missing_column\" does not exist",
        "schema_name": null,
        "severity": "ERROR",
        "severity_nonlocalized": "ERROR",
        "source_file": "parse_relation.c",
        "source_function": "errorMissingColumn",
        "source_line": "3859",
        "sqlstate": "42703",
        "statement_position": "8",
        "table_name": null,
        "text": "column \"missing_column\" does not exist\nLINE 1: SELECT missing_column FROM \"c42703_undefined_column\".\"column...\n               ^"
      },
      "failed_status": "IDLE",
      "repair_status": "IDLE",
      "repair_value": 1
    },
    "raw": "verify/results/42703-syntax-latest2/latest/raw.jsonl",
    "raw_sha256": "c64d56280f98f44ba414619546ff95719770ddee316bf91bfe81f682499aee62",
    "run_id": "42703-syntax-latest2",
    "server_version": "18.6 (Homebrew)",
    "server_version_num": 180006,
    "snippet_registry": {
      "id": "snippet-registry.42703",
      "kind": "local_artifact",
      "path": "verify/cases/42703/snippets.json",
      "sha256": "c272ed58f6f58ea22a8174108eb8c07a16283d10f356441c5981ce233679763a",
      "source_role": "snippet_registry"
    },
    "status": "passed",
    "summary": "verify/results/42703-syntax-latest2/latest/summary.json",
    "summary_sha256": "8534498cc6ae9888cdbaca81b6f71cb0bab74ce7a1440a7a821a74d97ac64bcd",
    "target": "latest"
  },
  "run_id": "42703-syntax-latest2",
  "runtime_id": "runtime.42703-syntax-latest2.latest",
  "server_version": "18.6 (Homebrew)",
  "status": "passed",
  "target": "latest"
}
runtimes · runtime.42703-syntax-pg10.pg10 · 10.21 (Debian 10.21-1.pgdg90+1) · passed
{
  "cases": [],
  "limits": "",
  "position": 1,
  "raw": {
    "assertions": [
      {
        "expected": "42703",
        "name": "42703 SQLSTATE",
        "observed": "42703",
        "passed": true
      },
      {
        "expected": "ERROR",
        "name": "42703 ERROR severity",
        "observed": "ERROR",
        "passed": true
      },
      {
        "expected": "column \"missing_column\" does not exist",
        "name": "42703 primary diagnostic",
        "observed": "column \"missing_column\" does not exist",
        "passed": true
      },
      {
        "expected": "IDLE",
        "name": "undefined column leaves session usable",
        "observed": "IDLE",
        "passed": true
      },
      {
        "expected": {
          "status": "IDLE",
          "value": 1
        },
        "name": "existing column repairs query",
        "observed": {
          "status": "IDLE",
          "value": 1
        },
        "passed": true
      }
    ],
    "case_manifest": {
      "id": "manifest.42703",
      "kind": "local_artifact",
      "path": "verify/cases/42703/cases.json",
      "sha256": "8034d1005edbc6093102a8e634bea65d7382b9061841da6bf781943a240caabb",
      "source_role": "case_manifest"
    },
    "cleanup": {
      "errors": [],
      "passed": true
    },
    "environment": {
      "TimeZone": "Etc/UTC",
      "backend_pid": 79,
      "binary": {},
      "connection_scope": "runner-owned localhost port",
      "current_user": "postgres",
      "docker": {
        "architecture": "arm64",
        "command": "/usr/local/bin/docker",
        "digest": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
        "id": "sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
        "image": "postgres:10",
        "image_created": "2022-06-23T09:11:18.374607054Z",
        "image_ref": "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc",
        "log_destination": "csvlog",
        "os": "linux",
        "repo_digests": [
          "postgres@sha256:b2baf8998630663d21370da06387c950e587071bdd307ee34e661cdcc7442bcc"
        ]
      },
      "lc_messages": "en_US.utf8",
      "libpq_version": "18.6",
      "locale": "en_US.UTF-8",
      "log_destination": "csvlog",
      "log_error_verbosity": "verbose",
      "log_min_error_statement": "error",
      "log_min_messages": "error",
      "logging_collector": "on",
      "machine": "arm64",
      "max_connections": "100",
      "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",
      "psycopg_version": "3.3.5",
      "python_version": "3.14.6 (main, Jun 10 2026, 10:03:53) [Clang 21.0.0 (clang-2100.0.123.102)]",
      "server_encoding": "UTF8",
      "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
      "server_version_num": "100021",
      "target_kind": "pg10",
      "wal_level": "logical"
    },
    "id": "runtime.42703-syntax-pg10.pg10",
    "observed": {
      "connection_autocommit": true,
      "diagnostic": {
        "column_name": null,
        "constraint_name": null,
        "context": null,
        "datatype_name": null,
        "exception_type": "UndefinedColumn",
        "internal_position": null,
        "internal_query": null,
        "message_detail": null,
        "message_hint": null,
        "message_primary": "column \"missing_column\" does not exist",
        "schema_name": null,
        "severity": "ERROR",
        "severity_nonlocalized": "ERROR",
        "source_file": "parse_relation.c",
        "source_function": "errorMissingColumn",
        "source_line": "3293",
        "sqlstate": "42703",
        "statement_position": "8",
        "table_name": null,
        "text": "column \"missing_column\" does not exist\nLINE 1: SELECT missing_column FROM \"c42703_undefined_column\".\"column...\n               ^"
      },
      "failed_status": "IDLE",
      "repair_status": "IDLE",
      "repair_value": 1
    },
    "raw": "verify/results/42703-syntax-pg10/pg10/raw.jsonl",
    "raw_sha256": "302a7e6973433e8769cbd14d73fa3bdef9f8bb63b686b161cbeffb0df63d290e",
    "run_id": "42703-syntax-pg10",
    "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
    "server_version_num": 100021,
    "snippet_registry": {
      "id": "snippet-registry.42703",
      "kind": "local_artifact",
      "path": "verify/cases/42703/snippets.json",
      "sha256": "c272ed58f6f58ea22a8174108eb8c07a16283d10f356441c5981ce233679763a",
      "source_role": "snippet_registry"
    },
    "status": "passed",
    "summary": "verify/results/42703-syntax-pg10/pg10/summary.json",
    "summary_sha256": "6fa32e82ef9b461054a9b50ff4ddc65b132cc2a9b564222e02d969bf04c050fc",
    "target": "pg10"
  },
  "run_id": "42703-syntax-pg10",
  "runtime_id": "runtime.42703-syntax-pg10.pg10",
  "server_version": "10.21 (Debian 10.21-1.pgdg90+1)",
  "status": "passed",
  "target": "pg10"
}
sources · src.errcodes.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/utils/errcodes.txt",
  "position": 0,
  "sha256": "6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba",
  "source_id": "src.errcodes.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt"
}
sources · src.calls.REL_18_6
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_18_6.jsonl",
  "position": 1,
  "sha256": "9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf",
  "source_id": "src.calls.REL_18_6",
  "tag": "",
  "url": ""
}
sources · src.calls.REL_10_23
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "raw/calls/REL_10_23.jsonl",
  "position": 2,
  "sha256": "00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c",
  "source_id": "src.calls.REL_10_23",
  "tag": "",
  "url": ""
}
sources · src.undefined-column.18.6
{
  "commit": "724edf9bde9d356724ad384a2e196edc3c9f80f7",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/parser/parse_relation.c",
  "position": 3,
  "sha256": "0d9c88f4a8def4c2d982c33f13208590e21ecf5e6f8cd9d7faa223dc771c9a9a",
  "source_id": "src.undefined-column.18.6",
  "tag": "REL_18_6",
  "url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_relation.c#L3854-L3859"
}
sources · src.undefined-column.10.23
{
  "commit": "02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4",
  "docs_url": "",
  "kind": "upstream_source",
  "location": "",
  "path": "src/backend/parser/parse_relation.c",
  "position": 4,
  "sha256": "a34f40fc93fa5df0015fe5af5ee7761ccba2d16a791cda69ae07848ed27616b5",
  "source_id": "src.undefined-column.10.23",
  "tag": "REL_10_23",
  "url": "https://github.com/postgres/postgres/blob/02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4/src/backend/parser/parse_relation.c#L3327-L3331"
}
sources · manifest.42703
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "verify/cases/42703/cases.json",
  "position": 5,
  "sha256": "8034d1005edbc6093102a8e634bea65d7382b9061841da6bf781943a240caabb",
  "source_id": "manifest.42703",
  "tag": "",
  "url": ""
}
sources · snippet-registry.42703
{
  "commit": "",
  "docs_url": "",
  "kind": "local_artifact",
  "location": "",
  "path": "verify/cases/42703/snippets.json",
  "position": 6,
  "sha256": "c272ed58f6f58ea22a8174108eb8c07a16283d10f356441c5981ce233679763a",
  "source_id": "snippet-registry.42703",
  "tag": "",
  "url": ""
}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · english-manuals:f0a0c7a2d67a0dca26fdaa9e81deeb23b9bfa785db813fd47fc2533352aebf1d

Text language: en · english-manuals:f0a0c7a2d67a0dca26fdaa9e81deeb23b9bfa785db813fd47fc2533352aebf1d