diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-09-11 00:06:42 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-09-11 00:06:42 +0000 |
commit | 82a47982f37077a9bfe67c0e9cc87b4f9b16e34b (patch) | |
tree | c9d600eddcc50bd7ff70061838bbdfcea8e68165 /src/backend/utils/fmgr | |
parent | b366562e43a8cd70bfb73efd8f5508608f92fd9b (diff) | |
download | postgresql-82a47982f37077a9bfe67c0e9cc87b4f9b16e34b.tar.gz |
Arrange for SET LOCAL's effects to persist until the end of the current top
transaction, unless rolled back or overridden by a SET clause for the same
variable attached to a surrounding function call. Per discussion, these
seem the best semantics. Note that this is an INCOMPATIBLE CHANGE: in 8.0
through 8.2, SET LOCAL's effects disappeared at subtransaction commit
(leading to behavior that made little sense at the SQL level).
I took advantage of the opportunity to rewrite and simplify the GUC variable
save/restore logic a little bit. The old idea of a "tentative" value is gone;
it was a hangover from before we had a stack. Also, we no longer need a stack
entry for every nesting level, but only for those in which a variable's value
actually changed.
Diffstat (limited to 'src/backend/utils/fmgr')
-rw-r--r-- | src/backend/utils/fmgr/fmgr.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index f2d49eaf53..ea5cd4bf2d 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.109 2007/09/03 00:39:18 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/fmgr/fmgr.c,v 1.110 2007/09/11 00:06:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -925,11 +925,10 @@ fmgr_security_definer(PG_FUNCTION_ARGS) if (fcache->proconfig) { - /* The options are processed as if by SET LOCAL var = val */ ProcessGUCArray(fcache->proconfig, (superuser() ? PGC_SUSET : PGC_USERSET), PGC_S_SESSION, - true); + GUC_ACTION_SAVE); } result = FunctionCallInvoke(fcinfo); @@ -937,8 +936,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) PG_CATCH(); { fcinfo->flinfo = save_flinfo; - if (fcache->proconfig) - AtEOXact_GUC(false, save_nestlevel); + /* We don't need to restore GUC settings, outer xact abort will */ if (OidIsValid(fcache->userid)) SetUserId(save_userid); PG_RE_THROW(); |