# 42883 — Undefined function

> PostgreSQL SQLSTATE 42883: Undefined function (undefined_function), source-backed diagnosis and recovery guidance.
---

# 42883 — Undefined function

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

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

| Field | Value |
| --- | --- |
| SQLSTATE | `42883` |
| Condition | `undefined_function` |
| 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_FUNCTION` |
| Aliases | `—` |

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

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

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

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

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

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

<!-- END SQLSTATE SNIPPET -->

The selected 18.6 and 10.21 runs passed SQLSTATE, severity, state/recovery, repair, cleanup, and isolated-target stop assertions. See [`case JSON`](../data/cases/42883.json) and [`authored evidence`](../data/evidence/42883.json); private manifest and registry hashes are recorded there.

## Versions {#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.

## Related {#related}

- [`42723`](../42723/)
- [`42725`](../42725/)
- [`42846`](../42846/)

## Sources {#sources}

- `src.errcodes.REL_18_6` — fixed definition at `724edf9bde9d356724ad384a2e196edc3c9f80f7`; SHA-256 `6e8de346643ba84aa3c9c6a73360acfc7b2dfb89162c06c08ce9bf5bcd5bbcba` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/errcodes.txt#L1-L1)).
- `src.undefined-function.18.6` — `src/backend/parser/parse_func.c` lines 629–636 at `724edf9bde9d356724ad384a2e196edc3c9f80f7`; blob SHA-256 `48314eab022297478ac4e49786afaff2621ab7b1d7b50e156668cf477961384f` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_func.c#L629-L636)).
- `src.undefined-function.10.23` — `src/backend/parser/parse_func.c` lines 521–528 at `02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4`; blob SHA-256 `f1b4af88565ca01dbad2b244cd26b42f34764b3f1343b22a9231e271fb0742f2` ([source](https://github.com/postgres/postgres/blob/02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4/src/backend/parser/parse_func.c#L521-L528)).
- `src.undefined-operator.18.6` — `src/backend/parser/parse_oper.c` lines 619–644 at `724edf9bde9d356724ad384a2e196edc3c9f80f7`; blob SHA-256 `3866ce3302c2a4bd22d0f1d113a4bbc627278a618d5e7b83660e36240cbdd0a8` ([source](https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/parser/parse_oper.c#L619-L644)).
- `src.undefined-operator.10.23` — `src/backend/parser/parse_oper.c` lines 706–728 at `02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4`; blob SHA-256 `5802db6d55bdb41f9cad4957384fa2c2ddbb4dc902c33f5f57e8a07760761d10` ([source](https://github.com/postgres/postgres/blob/02991e79f8f58bc208f05dcc8af0c62dbe0a6ea4/src/backend/parser/parse_oper.c#L706-L728)).
- `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.
