select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / CLIENT CONNECTION DEFAULTS

check_function_bodies

Read PG 18 manual ↗

This parameter is normally on.

Type
bool
Context
user
Measured default
on
Unit
Metadata snapshot
18

Definition PG 18 manual

This parameter is normally on. When set to off, it disables validation of the routine body string during CREATE FUNCTION and CREATE PROCEDURE. Disabling validation avoids side effects of the validation process, in particular preventing false positives due to problems such as forward references. Set this parameter to off before loading functions on behalf of other users; pg_dump does so automatically.

Measured default history
Version intervalDefault
9.0 – 19on
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

check_function_bodies checks routine bodies during CREATE FUNCTION and CREATE PROCEDURE. Turning it off suppresses creation-time validation, which is useful for dump restores and forward references but defers errors until execution.

check_function_bodies is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.

It supplies a default only when SQL omits an explicit choice, so schema migrations, object-level options, privileges, and later ALTER operations can override or outlive it.

Operational considerations

Changing check_function_bodies in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.

Expecting a changed default to rewrite existing objects or override explicit DDL clauses.

Ignoring tablespace privileges, installed access methods or compression support, and restore portability.

Changing check_function_bodies globally without a rollback plan and a client or operational compatibility test.

Workload guidance

OLAP: Analytical routines need the same creation-time validation; bulk deployment is not a reason to hide syntax or dependency errors.

OLTP: Keep check_function_bodies on for ordinary migrations so invalid routine bodies fail early. Disable it only inside a controlled dump restore or forward-reference sequence and restore it immediately.

SMALL: Leave it on. Validation cost occurs at routine creation and is preferable to discovering a broken function during production execution.

Version history 1
  1. PG 13 → 14changed

Related entries

Further reading

Definition snapshot: english-manuals:d6d377cc424d94dcdada1a3052d… · English manual source