]> granicus.if.org Git - postgresql/commit
Don't fail for bad GUCs in CREATE FUNCTION with check_function_bodies off.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 3 Sep 2013 22:32:29 +0000 (18:32 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 3 Sep 2013 22:32:29 +0000 (18:32 -0400)
commit8e67a28eea9b7d068bdbe8fc9978f7fb2edda54b
tree1921c3eab59e99759f3ff1854eafc6f1a013f05e
parentf8730733e048159702a74b82b1106e0646bfaac5
Don't fail for bad GUCs in CREATE FUNCTION with check_function_bodies off.

The previous coding attempted to activate all the GUC settings specified
in SET clauses, so that the function validator could operate in the GUC
environment expected by the function body.  However, this is problematic
when restoring a dump, since the SET clauses might refer to database
objects that don't exist yet.  We already have the parameter
check_function_bodies that's meant to prevent forward references in
function definitions from breaking dumps, so let's change CREATE FUNCTION
to not install the SET values if check_function_bodies is off.

Authors of function validators were already advised not to make any
"context sensitive" checks when check_function_bodies is off, if indeed
they're checking anything at all in that mode.  But extend the
documentation to point out the GUC issue in particular.

(Note that we still check the SET clauses to some extent; the behavior
with !check_function_bodies is now approximately equivalent to what ALTER
DATABASE/ROLE have been doing for awhile with context-dependent GUCs.)

This problem can be demonstrated in all active branches, so back-patch
all the way.
doc/src/sgml/plhandler.sgml
src/backend/catalog/pg_proc.c
src/test/regress/expected/guc.out
src/test/regress/sql/guc.sql