function does not exist
The query parser/planner could not find a function (or operator) with the given name and argument type signature in the current search_path. Postgres performs function resolution at parse time using the name and the types of all arguments.
- 1Misspelled function name
- 2Function exists in a different schema not in search_path
- 3Calling a function with incorrect argument types (Postgres overloads by signature)
- 4Required extension not installed (e.g., calling uuid_generate_v4() without uuid-ossp)
- 5Function was dropped or never created in this database
A function is called with a wrong name or from a schema not in search_path.
SELECT uuid_generate_v4(); -- requires uuid-ossp extension
expected output
ERROR: function uuid_generate_v4() does not exist LINE 1: SELECT uuid_generate_v4(); HINT: No function matches the given name and argument types. You might need to add explicit type casts.
Fix 1
Install the required extension
WHEN When the function is provided by an extension that is not yet installed.
CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; SELECT uuid_generate_v4(); -- Or use the built-in alternative (Postgres 13+): SELECT gen_random_uuid();
Why this works
Extensions package functions, types, and operators. CREATE EXTENSION copies the extension's SQL objects into the current database's catalog. After installation, the functions are discoverable in the search_path and the planner can resolve them.
Fix 2
Check function signature and add explicit casts
WHEN When the function exists but is being called with the wrong argument types.
-- Find matching overloads: SELECT proname, pg_get_function_arguments(oid) FROM pg_proc WHERE proname = 'my_function'; -- Call with explicit cast if needed: SELECT my_function(42::BIGINT);
Why this works
Postgres function overloading is resolved by matching argument types exactly (after implicit cast consideration). pg_proc stores all function signatures; querying it reveals which overloads exist and what argument types they expect.
✕ Add the function's schema to search_path permanently at the database level without review
Expanding search_path can cause name conflicts and unintended function shadowing from attacker-controlled schemas.
gen_random_uuid() is built-in; no extension needed for UUID generation.
src/backend/parser/parse_func.c — ParseFuncOrColumn()
Function Type Resolution ↗Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev