Developmentversion 2.10
plpgsql_check
Lint PL/pgSQL functions before they run.
What it is for
PL/pgSQL only checks a function body when each statement runs, so a typo in a rarely used branch can sit unnoticed. plpgsql_check analyses the whole function ahead of time: unknown columns, type mismatches, unused variables and missing RETURN paths.
Enable it
create extension if not exists plpgsql_check with schema extensions;Example
select * from plpgsql_check_function('public.handle_new_user()');
-- every PL/pgSQL function in public
select p.proname, c.*
from pg_proc p
cross join lateral plpgsql_check_function(p.oid) c
where p.pronamespace = 'public'::regnamespace
and p.prolang = (select oid from pg_language where lanname = 'plpgsql');Questions
How do I enable plpgsql_check?
Run create extension if not exists plpgsql_check with schema extensions; in the SQL editor, or switch it on from the Extensions page in the console. You do not need superuser access.
Which version of plpgsql_check is installed?
2.10, on Postgres 17.6, as read from the running engine on 2026-10-08. Check yours with: select extversion from pg_extension where extname = 'plpgsql_check';
Upstream project: github.com/okbob/plpgsql_check
More development extensions
- tablefunc Crosstab and other table functions.