check_function_bodies
Fact — official short description: “Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.0–19 Beta 3 | on |
— | on |
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.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| 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. |
| OLAP | Analytical routines need the same creation-time validation; bulk deployment is not a reason to hide syntax or dependency errors. |
| Small nodes | Leave it on. Validation cost occurs at routine creation and is preferable to discovering a broken function during production execution. |
Pigsty
Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.
| Template | Effective value | Versus upstream boot | Source expression |
|---|---|---|---|
| OLTP | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.
Common pitfalls
- 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.
Related parameters
default_table_access_method · default_tablespace · temp_tablespaces · default_toast_compression · maintenance_work_mem
References
- PostgreSQL 19 Beta 3 — check_function_bodies
- PostgreSQL 19 release notes
- Machine-readable GUC export