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

undefined_function

SQLSTATE
42883
Condition name
undefined_function
Class
Syntax Error or Access Rule Violation
Source macro
ERRCODE_UNDEFINED_FUNCTION
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>42883 — Undefined function</h1>

At a glance

42883 is undefined_function: lookup found no compatible function for the requested name and input types. The same condition is also used by the parser's undefined-operator branch. The case calls a schema-qualified integer function signature before it exists.

Meaning

The parser resolves name, schema visibility, input types, and overloads together. The selected function group reports function %s does not exist and hints that no function matches the name and argument types; a sibling parse_oper.c branch reports operator does not exist: %s with the corresponding operator hint under the same SQLSTATE. Distinguish 42725 (candidates but ambiguous) and 42846 (a chosen expression cannot be cast). Inspect pg_proc/identity arguments for functions and pg_operator plus operand types for operators. An extension-provided routine or operator may simply be unavailable on this server or version, so availability is part of the diagnosis.

Diagnosis

Capture the fully rendered name and signature. Query pg_proc with pg_get_function_identity_arguments for functions, and inspect pg_operator and both operand types for operators. Verify current_schema and search_path without assuming a different path is correct; check whether the object is a function, procedure, operator, or extension-provided feature. For extension/version candidates, inspect installed extension metadata and server_version_num before changing SQL.

Response

Call the intended signature explicitly, or create that exact function in the intended schema when you own the API. If the missing object is supplied by an extension or newer server feature, install or enable the intended dependency only when it is part of the deployment contract; do not create a substitute merely because the lookup failed. Do not blindly alter search_path or add casts, since they can select another routine or operator. The case creates missing_function(integer) and returns 42. In an explicit transaction, the error leaves INERROR until rollback or a suitable savepoint; the selected autocommit error leaves IDLE.

Observed diagnostics

The selected parser function group is explicit ERROR: primary function %s does not exist, hint No function matches the given name and argument types. You might need to add explicit type casts. The source-only operator group is also ERROR: primary operator does not exist: %s; with two known operand types its hint is No operator matches the given name and argument types. You might need to add explicit type casts., while a missing operand uses the singular type form. These are distinct producers sharing 42883.

Representative case

The runner calls the missing schema-qualified function, checks the expanded signature and state, creates the exact integer signature, and repeats the call.

SELECT syntax_schema.missing_function(41);
CREATE FUNCTION syntax_schema.missing_function(integer) RETURNS integer LANGUAGE SQL AS 'SELECT $1 + 1';
SELECT syntax_schema.missing_function(41);

The selected 18.6 and 10.21 runs passed SQLSTATE, severity, state/recovery, repair, cleanup, and isolated-target stop assertions. See case JSON and authored evidence; private manifest and registry hashes are recorded there.

Versions

The locked catalogue contains this condition from the 7.4 presence bound through the listed snapshots. The selected natural case passed on PostgreSQL 18.6 and 10.21; that bounded result does not infer every intermediate release or every source branch.

Sources

  • src.errcodes.REL_18_6 — fixed definition at 724edf9bde9d356724ad384a2e196edc3c9f80f7; SHA-256 6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba (source).
  • src.undefined-function.18.6src/backend/parser/parse_func.c lines 629–636 at 724edf9bde9d356724ad384a2e196edc3c9f80f7; blob SHA-256 48314eab022297478ac4e49786afaff2621ab7b1d7b50e156668cf477961384f (source).
  • src.undefined-function.10.23src/backend/parser/parse_func.c lines 521–528 at 02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4; blob SHA-256 f1b4af88565ca01dbad2b244cd26b42f34764b3f1343b22a9231e271fb0742f2 (source).
  • src.undefined-operator.18.6src/backend/parser/parse_oper.c lines 619–644 at 724edf9bde9d356724ad384a2e196edc3c9f80f7; blob SHA-256 3866ce3302c2a4bd22d0f1d113a4bbc627278a618d5e7b83660e36240cbdd0a8 (source).
  • src.undefined-operator.10.23src/backend/parser/parse_oper.c lines 706–728 at 02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4; blob SHA-256 5802db6d55bdb41f9cad4957384fa2c2ddbb4dc902c33f5f57e8a07760761d10 (source).
  • src.calls.REL_18_6 / src.calls.REL_10_23 — fixed call scans, SHA-256 9ee8a0e81d8f0825c5c1ae45583439859a26e602bdd4ce2f2a62aa278867ccbf / 00d16d3eb01b71ccf1b245c8f3102f9d0ec9f36fb02777b8dd1b99fcb263040c.
  • manifest.42883 / snippet-registry.42883 — hashes are recorded in evidence/42883.json and each runtime record.

Source evidence

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

42883 is the undefined_function condition in Class 42.

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

Limits: Identity does not identify every backend call that can reuse this SQLSTATE.

src.errcodes.REL_18_6

The selected missing_function_resolution follows a resolved PostgreSQL source-call group; other branches can use different dynamic fields.

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

Limits: This is one mechanism boundary, not an exhaustive inventory of the code.

src.undefined-function.18.6 src.undefined-function.10.23

Resolve function or operator name, schema visibility, exact argument types, overloads, and extension/server feature availability before changing search_path or casts.

Method: Combine the selected source call, registry SQL, and passed structured assertions.

Limits: The claim describes the selected path and does not generalize to every branch sharing this SQLSTATE.

src.undefined-function.18.6 src.undefined-function.10.23 src.undefined-operator.18.6 src.undefined-operator.10.23 snippet-registry.42883

parse_oper.c reuses 42883 for an unresolved operator and formats the operator signature with a plural or singular operand-type hint depending on which argument types are known.

Method: Read the complete fixed op_error branch in both locked parse_oper.c snapshots.

Limits: The selected runtime exercises the function producer; operator resolution and extension/version availability remain source-only here.

src.undefined-operator.18.6 src.undefined-operator.10.23

The selected missing_function_resolution passed on isolated PostgreSQL 18.6 and 10.21 targets.

Method: Run the shared SQL registry and inspect SQLSTATE, severity, state, repair, cleanup, and target stop.

Limits: Scope is limited to these statements, psycopg, and two versions.

manifest.42883 snippet-registry.42883

The locked catalogue records 42883 from the 7.4 presence bound through the listed snapshots; runtime scope is 18.6 and 10.21.

Method: Read generated facts, fixed calls, and selected summaries.

Limits: Definition presence is not an exact behavioral introduction; two runtime versions do not prove every intermediate behavior.

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

Message templates

explicit ERROR · message.missing_function_resolution

Primary

function %s does not exist

Hint

No function matches the given name and argument types. You might need to add explicit type casts.
explicit ERROR · message.missing_operator_resolution

Primary

operator does not exist: %s

Hint

No operator matches the given name and argument types. You might need to add explicit type casts.

Hint

No operator matches the given name and argument type. You might need to add an explicit type cast.

Reproduction & repair cases

missing_function_resolution · PG 10, 18

Preconditions

  • A runner-owned disposable target is provisioned.

Trigger: Call a schema-qualified function with an integer argument before that signature exists.

Expected assertions

  • SQLSTATE is 42883 and the diagnostic names the missing function signature
  • The failed autocommit session remains IDLE
  • Creating the exact integer signature then returns 42

Repair: Check schema visibility, function/operator name, argument types, and overload resolution; create or call the intended signature rather than blindly changing search_path.

Cleanup: Drop the runner schema and its function.

Recorded runtime evidence

18.6 (Homebrew) · passed

Run: syntax2-42883-latest

{
  "diagnostic": {
    "text": "function c42883_missing_function_resolution.missing_function(integer) does not exist\nLINE 1: SELECT \"c42883_missing_function_resolution\".missing_function...\n               ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts.",
    "context": null,
    "severity": "ERROR",
    "sqlstate": "42883",
    "table_name": null,
    "column_name": null,
    "schema_name": null,
    "source_file": "parse_func.c",
    "source_line": "636",
    "message_hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
    "datatype_name": null,
    "exception_type": "UndefinedFunction",
    "internal_query": null,
    "message_detail": null,
    "constraint_name": null,
    "message_primary": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
    "source_function": "ParseFuncOrColumn",
    "internal_position": null,
    "statement_position": "8",
    "severity_nonlocalized": "ERROR"
  },
  "repair_value": 42,
  "failed_status": "IDLE",
  "repair_status": "IDLE",
  "connection_autocommit": true
}
10.21 (Debian 10.21-1.pgdg90+1) · passed

Run: syntax2-42883-pg10

{
  "diagnostic": {
    "text": "function c42883_missing_function_resolution.missing_function(integer) does not exist\nLINE 1: SELECT \"c42883_missing_function_resolution\".missing_function...\n               ^\nHINT:  No function matches the given name and argument types. You might need to add explicit type casts.",
    "context": null,
    "severity": "ERROR",
    "sqlstate": "42883",
    "table_name": null,
    "column_name": null,
    "schema_name": null,
    "source_file": "parse_func.c",
    "source_line": "528",
    "message_hint": "No function matches the given name and argument types. You might need to add explicit type casts.",
    "datatype_name": null,
    "exception_type": "UndefinedFunction",
    "internal_query": null,
    "message_detail": null,
    "constraint_name": null,
    "message_primary": "function c42883_missing_function_resolution.missing_function(integer) does not exist",
    "source_function": "ParseFuncOrColumn",
    "internal_position": null,
    "statement_position": "8",
    "severity_nonlocalized": "ERROR"
  },
  "repair_value": 42,
  "failed_status": "IDLE",
  "repair_status": "IDLE",
  "connection_autocommit": true
}

Definition snapshot: english-manuals:42178bdd4e13dd27039d48890e4… · English manual source