Postgres: function does not exist (SQLSTATE 42883)
PostgreSQL matches functions by exact argument types. Add the cast the hint suggests, install the extension, or fix the search_path.

Introduction & Quick Summary
A query that looks ordinary is rejected before it runs:
ERROR: function lower(uuid) does not exist
LINE 1: select lower(id) from users;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQLSTATE: 42883Quick answer: PostgreSQL resolves functions by the exact argument types, and it will not convert uuid to text on its own. Give it the type the function expects, or call the function that exists for that type:
select lower(id::text) from users; -- explicit cast
select id::text from users; -- if lower() was not needed
select id from users where id = '9f1c…'::uuid; -- cast the literal, not the columnThe hint is the useful part: the parser found some function with that name but none whose signature matches what you passed. The usual causes are a missing cast, an extension that was never installed, a function living in a schema outside search_path, or an implicit cast PostgreSQL deliberately does not perform. This guide covers the resolution rules in the order the server applies them and the catalog queries that show what is actually callable.
Core Mechanics, Signatures & Reproducible Setup
Function lookup in PostgreSQL proceeds in fixed steps, and 42883 means none of them matched:
- Candidate functions with the given name, visible in
search_path, are collected. - Exact type matches win immediately.
- Only implicit casts are considered — a limited set (
integertobigint,texttovarchar, and similar). There is no implicit cast fromtexttouuid,uuidtotext, orjsonbtotext. unknownliterals are coerced if exactly one candidate fits.- If several remain or none do, the statement fails.
A reproduction with two functions of the same name:
create table users (id uuid primary key default gen_random_uuid(), email text);
insert into users (email) values ('A@EXAMPLE.COM');
select lower(id) from users;
-- ERROR: function lower(uuid) does not exist
select lower(email) from users; -- 'a@example.com'
select lower(id::text) from users; -- worksThe catalog tells you what signatures exist, which is faster than guessing:
\df lower
-- Schema | Name | Result data type | Argument data types
-- public | lower | text | text
select p.proname, pg_get_function_identity_arguments(p.oid) as args,
n.nspname as schema
from pg_proc p join pg_namespace n on n.oid = p.pronamespace
where p.proname in ('lower', 'to_char', 'gen_random_uuid')
order by n.nspname, p.proname;Key Comparison Table
| Message | Cause | Fix |
|---|---|---|
function lower(uuid) does not exist | no implicit cast to text | cast the argument |
function gen_random_uuid() does not exist | extension missing on older releases | create extension pgcrypto |
function unaccent(text) does not exist | unaccent extension not installed | create extension unaccent |
function public.set_updated_at() does not exist | function in another schema | qualify or fix search_path |
function to_char(timestamp without time zone) | wrong arity | add the format argument |
operator does not exist: uuid = text | operator resolution, same code | cast one side |
| Resolution step | What it accepts | Example |
|---|---|---|
| exact match | identical types | lower(text) |
| implicit cast | server-defined safe casts | int4 → int8 |
unknown literal | one candidate | to_date('2026-11-28', 'YYYY-MM-DD') |
| named-argument match | parameter names | date_trunc(unit => 'day', source => ts) |
| variadic match | array expansion | concat_ws('-', a, b) |
| Diagnosis | Query |
|---|---|
| which schema is visible | select current_schemas(true); |
| search path order | show search_path; |
| installed extensions | select extname, extnamespace::regnamespace from pg_extension; |
| function definition | \df+ function_name |
| operator as a function | select oprname, oprleft::regtype, oprright::regtype from pg_operator where oprname = '='; |
Practical Edge Cases, Error Fixes & Deep Dive Code Examples
1. Cast the argument, not the whole expression
Adding a cast in the right place keeps the query sargable, which matters for indexes:
-- index on id (uuid) stays usable
select * from users where id = '9f1c7a3e-0000-0000-0000-000000000000'::uuid;
-- index on id may be skipped: the column is cast, not the literal
select * from users where id::text = '9f1c7a3e-0000-0000-0000-000000000000';When the function itself needs text, the cast is unavoidable, but pushing it to the literal side where possible prevents a per-row conversion.
2. Extensions that provide the function
gen_random_uuid() is built in from PostgreSQL 13, while on 12 and earlier it comes from pgcrypto. unaccent, uuid-ossp, citext and pg_trgm are separate extensions, and a restored dump can reference them without their definitions:
select gen_random_uuid();
-- ERROR: function gen_random_uuid() does not exist
create extension if not exists pgcrypto;
select gen_random_uuid(); -- worksOn managed services the extension must also be allowed for the database; Supabase, RDS, and Cloud SQL each expose a different list of permitted extensions.
3. search_path and functions in other schemas
A function can exist and still be invisible. Compare the path with the schema that owns it, and qualify the call when the schema is not on the path:
show search_path; -- "$user", public
select util.slugify('Hello World'); -- explicit schema
-- or make the path explicit for the session
set search_path = public, util;This is common after moving helpers into an util or app schema, and inside SECURITY DEFINER functions where the path is set explicitly and does not include the caller's schemas.
4. Overloads and wrong arity
Same name, different number of arguments is a different function. Passing a timestamp without a format, or three arguments to a two-argument function, produces 42883 with the argument list spelled out:
select to_char(now()); -- ERROR: function to_char(timestamp with time zone) does not exist
select to_char(now(), 'YYYY-MM-DD'); -- ok
select substring('abcdef', 2); -- substring(text, integer)
select substring('abcdef' from 2 for 3); -- SQL syntax form, same function5. Custom functions and default arguments
A user-defined function is resolved like any other, so its schema, name and parameter types must match exactly. Recreating a function with a different signature leaves the old one in place:
create or replace function app.total(p_rows integer) returns bigint
language sql as $$ select coalesce(sum(x), 0)::bigint from generate_series(1, p_rows) x $$;
select app.total(5);
select app.total(5::bigint); -- ok: implicit int4 -> int8
select app.total('5'); -- ok: unknown literal coerceddrop function needs the argument types for the same reason: drop function app.total(integer); removes the version you mean.
6. Operators are functions too
operator does not exist: uuid = text carries the same SQLSTATE. The cast rule is identical, and the fix is to align the two sides rather than adding a different operator:
select * from users u join events e on e.user_id = u.id::text; -- slow, and often wrong
select * from users u join events e on e.user_id = u.id; -- types alignedThe second version needs events.user_id to be uuid; if it is text, fix the column type once instead of casting in every query. Reading the join plan after the change is easier with the SQL formatter, and a quick check of the column types before writing the query is faster with the SQL schema tool.
Common Compilation/Runtime Mistakes & Version Gotchas
- Casting the column instead of the literal. It disables the index and hides the real type mismatch.
create extensionin the wrong schema. The function becomes invisible; usewith schema public.- Assuming
textanduuidare interchangeable. They are not, and PostgreSQL does not provide an implicit cast in either direction. - Dropping a function without argument types.
drop function ffails or removes the wrong overload. - Ignoring the hint. The hint lists the argument types the server saw, which is usually enough to spot the surprise.
- Version notes.
gen_random_uuid()is built in from PostgreSQL 13 and needspgcryptobefore that.CREATE EXTENSIONuses the schema named in its control file unlessSCHEMAis given, and since PostgreSQL 15 non-owners cannot create objects inpublic, which moves helper functions into their own schema and makessearch_pathmistakes more common.
Official documentation: Error codes (42883) and Function type resolution.
Official references
primary documentationThe SQL documentation that defines the behaviour this guide explains.
Try matching browser tools
All toolsSmall utilities that fit SQL work — they run entirely in this browser tab, so nothing you paste leaves your device.
Related SQL guides
All SQL guidesSQLite: database is locked (SQLITE_BUSY) under concurrent writes
SQLite allows one writer. Set a busy timeout, switch to WAL, start write transactions as IMMEDIATE, and reduce to a single writer connection.
Postgres: column does not exist (SQLSTATE 42703)
42703 means the identifier you wrote is not the one that exists. Check case folding, alias scope, search_path and migration drift.
PostgreSQL: canceling statement due to statement timeout
The statement was canceled by statement_timeout. Find whether the role, the pooler or the client set it, then scope a longer budget to that job.
pg_dump: server version mismatch, aborting because of server version
pg_dump refuses to read a newer server. Install a matching client, run it from a container or the server host, and match pg_restore too.
More in SQL
All SQL guidesThe guides filed next to this one in SQL, in library order.