pgsql: Don't fail for bad GUCs in CREATE FUNCTION with check_function_b - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Don't fail for bad GUCs in CREATE FUNCTION with check_function_b
Date
Msg-id E1VGz9q-0005QW-6p@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/f74a024c33702d46af1261ac4c6314576018b4fe

Modified Files
--------------
src/backend/catalog/pg_proc.c     |   34 ++++++++++++++++++++++------------
src/test/regress/expected/guc.out |   16 ++++++++++++++++
src/test/regress/sql/guc.sql      |   18 ++++++++++++++++++
3 files changed, 56 insertions(+), 12 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Don't fail for bad GUCs in CREATE FUNCTION with check_function_b
Next
From: Tom Lane
Date:
Subject: pgsql: Don't fail for bad GUCs in CREATE FUNCTION with check_function_b