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/adt/ri_triggers.c | |
parent | b366562e43a8cd70bfb73efd8f5508608f92fd9b (diff) | |
download | postgresql-82a47982f37077a9bfe67c0e9cc87b4f9b16e34b.tar.gz postgresql-82a47982f37077a9bfe67c0e9cc87b4f9b16e34b.zip |
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/adt/ri_triggers.c')
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 9add8f934d8..e3a01ed76a9 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -15,7 +15,7 @@ * * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.96 2007/08/15 19:15:46 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.97 2007/09/11 00:06:42 tgl Exp $ * * ---------- */ @@ -2749,7 +2749,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) snprintf(workmembuf, sizeof(workmembuf), "%d", maintenance_work_mem); (void) set_config_option("work_mem", workmembuf, PGC_USERSET, PGC_S_SESSION, - true, true); + GUC_ACTION_LOCAL, true); if (SPI_connect() != SPI_OK_CONNECT) elog(ERROR, "SPI_connect failed"); @@ -2832,13 +2832,12 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) /* * Restore work_mem for the remainder of the current transaction. This is - * another SET LOCAL, so it won't affect the session value, nor any - * tentative value if there is one. + * another SET LOCAL, so it won't affect the session value. */ snprintf(workmembuf, sizeof(workmembuf), "%d", old_work_mem); (void) set_config_option("work_mem", workmembuf, PGC_USERSET, PGC_S_SESSION, - true, true); + GUC_ACTION_LOCAL, true); return true; } |