Parameter · Client Connection Defaults / Statement Behavior
check_function_bodies
Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE.
- Default:
on - Type: bool
- Applies: Session (any user)
In plain words
When on (default), CREATE FUNCTION checks the body right away, for example that tables referenced by a SQL function exist, so mistakes show up immediately. When off, the function is stored as-is and errors appear only when it runs.
For DBAs and operators
What is checked depends on the language: SQL-language bodies are parsed and analyzed (tables and columns must exist), PL/pgSQL bodies are syntax-checked (table references are only resolved at run time anyway). With it off, only the body string is stored.
pg_dump output starts with SET check_function_bodies = false; because functions may be restored before the objects they reference. If you replay a dump in pieces or with a tool that drops that line, restore fails with errors like ERROR: relation "nosuchtable" does not exist during CREATE FUNCTION.
Turn it off only for loading; keep it on for development so errors appear early. Functions written with the SQL-standard BEGIN ATOMIC body (PostgreSQL 14+) are always parsed and analyzed at creation, even with this setting off, and record dependencies on the objects they use.
How to change it
Any user can change it for their session with SET.