{"Entry":{"collection":"guc","key":"check_function_bodies","name":"check_function_bodies","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Client Connection Defaults / Statement Behavior","category_zh":"","changed_in":["14"],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":true,"fields":{},"from":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{"short_desc":{"from":"Check function bodies during CREATE FUNCTION.","to":"Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE."}},"from":"13","status":"changed","to":"14"}],"content_hash":"b1b7e0457fff1ce487d7bc8091077f1ffa7b1b9f315dddb28363f11f0647d93e","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"on"}],"editorial":{"advice":{"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."},"mechanism":["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."],"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."],"references":[{"title":"PostgreSQL 19 Beta 4: check_function_bodies","url":"https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-CHECK-FUNCTION-BODIES"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["default_table_access_method","default_tablespace","temp_tablespaces","default_toast_compression","maintenance_work_mem"],"summary":"check_function_bodies is the PostgreSQL setting that controls whether PostgreSQL checks routine bodies during CREATE FUNCTION and CREATE PROCEDURE."},"enumvals":[],"first_version":"7.4","group":"Client Connection Defaults","group_slug":"client","imported_at":"2026-09-27T17:57:30.915512+08:00","intro_commit":{},"key":"check_function_bodies","last_version":"20","max_val":"","min_val":"","name":"check_function_bodies","position":54,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"This parameter is normally on.","short_desc_zh":"","source_rev":"english-manuals:22be8ee3e3904829c33bba97601a7d05d586e8de460a01bad26d37ab9ccff8f3","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"check_function_bodies","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"check_function_bodies","SourceRevision":"english-manuals:22be8ee3e3904829c33bba97601a7d05d586e8de460a01bad26d37ab9ccff8f3","Facts":{"boot_val":"on","category":"Client Connection Defaults / Statement Behavior","context":"user","description":"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.","doc":{"anchor":"GUC-CHECK-FUNCTION-BODIES","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"check_function_bodies","short_desc":"Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-CHECK-FUNCTION-BODIES","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"check_function_bodies","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"check_function_bodies","Summary":"","BodyHTML":"\u003cp\u003e这个参数通常为打开。当设置为\u003ccode\u003eoff\u003c/code\u003e时，它禁用\u003ca href=\"/docs/18/sql-createfunction.html\" title=\"CREATE FUNCTION\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE FUNCTION\u003c/span\u003e\u003c/a\u003e和\u003ca href=\"/docs/18/sql-createprocedure.html\" title=\"CREATE PROCEDURE\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE PROCEDURE\u003c/span\u003e\u003c/a\u003e期间对例程体字符串的验证。禁用验证避免了验证处理的副作用，特别是避免前向引用等问题导致的误报。在代表其他用户载入函数之前设置这个参数为\u003ccode\u003eoff\u003c/code\u003e；\u003cspan\u003epg_dump\u003c/span\u003e会自动这样做。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"ee2663cb068ddab30f50719aed726f232f10eb5b7b42ebb9aac6f3049f67b9dc","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e这个参数通常为打开。当设置为\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e时，它禁用\u003ca href=\"/docs/18/sql-createfunction.html\" title=\"CREATE FUNCTION\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FUNCTION\u003c/span\u003e\u003c/a\u003e和\u003ca href=\"/docs/18/sql-createprocedure.html\" title=\"CREATE PROCEDURE\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE PROCEDURE\u003c/span\u003e\u003c/a\u003e期间对例程体字符串的验证。禁用验证避免了验证处理的副作用，特别是避免前向引用等问题导致的误报。在代表其他用户载入函数之前设置这个参数为\u003ccode class=\"literal\"\u003eoff\u003c/code\u003e；\u003cspan class=\"application\"\u003epg_dump\u003c/span\u003e会自动这样做。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
