summaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane2013-09-03 22:32:26 +0000
committerTom Lane2013-09-03 22:32:26 +0000
commit9ac5f63cea2d88ed4a06c06399258c5d3ba04c57 (patch)
tree17bf81bea045d0c198b82c2ff560ace06c8e4a95 /doc/src
parentbc63ff2401a34a4ec6547f2a03072b68a268f9ec (diff)
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.
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/plhandler.sgml7
1 files changed, 7 insertions, 0 deletions
diff --git a/doc/src/sgml/plhandler.sgml b/doc/src/sgml/plhandler.sgml
index 54b88ef372e..024ef9d3b85 100644
--- a/doc/src/sgml/plhandler.sgml
+++ b/doc/src/sgml/plhandler.sgml
@@ -200,6 +200,13 @@ CREATE LANGUAGE plsample
of having a validator is not to let the call handler omit checks, but
to notify the user immediately if there are obvious errors in a
<command>CREATE FUNCTION</> command.)
+ While the choice of exactly what to check is mostly left to the
+ discretion of the validator function, note that the core
+ <command>CREATE FUNCTION</> code only executes <literal>SET</> clauses
+ attached to a function when <varname>check_function_bodies</> is on.
+ Therefore, checks whose results might be affected by GUC parameters
+ definitely should be skipped when <varname>check_function_bodies</> is
+ off, to avoid false failures when reloading a dump.
</para>
<para>