OSDN Git Service

Arrange for SET LOCAL's effects to persist until the end of the current top
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Sep 2007 00:06:42 +0000 (00:06 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 11 Sep 2007 00:06:42 +0000 (00:06 +0000)
commit82a47982f37077a9bfe67c0e9cc87b4f9b16e34b
treec9d600eddcc50bd7ff70061838bbdfcea8e68165
parentb366562e43a8cd70bfb73efd8f5508608f92fd9b
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.
16 files changed:
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/ref/prepare_transaction.sgml
doc/src/sgml/ref/reset.sgml
doc/src/sgml/ref/set.sgml
doc/src/sgml/ref/show.sgml
src/backend/utils/adt/ri_triggers.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/init/miscinit.c
src/backend/utils/init/postinit.c
src/backend/utils/misc/README
src/backend/utils/misc/guc-file.l
src/backend/utils/misc/guc.c
src/include/utils/guc.h
src/include/utils/guc_tables.h
src/test/regress/expected/guc.out
src/test/regress/sql/guc.sql