Arrange for SET LOCAL's effects to persist until the end of the current top
Tom Lane <tgl@sss.pgh.pa.us>
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.
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/ref/create_function.sgml | modified | +5 −5 |
| doc/src/sgml/ref/prepare_transaction.sgml | modified | +3 −2 |
| doc/src/sgml/ref/reset.sgml | modified | +22 −9 |
| doc/src/sgml/ref/set.sgml | modified | +46 −11 |
| doc/src/sgml/ref/show.sgml | modified | +7 −3 |
| src/backend/utils/adt/ri_triggers.c | modified | +4 −5 |
| src/backend/utils/fmgr/fmgr.c | modified | +3 −5 |
| src/backend/utils/init/miscinit.c | modified | +2 −2 |
| src/backend/utils/init/postinit.c | modified | +2 −2 |
| src/backend/utils/misc/guc.c | modified | +349 −367 |
| src/backend/utils/misc/guc-file.l | modified | +10 −11 |
| src/backend/utils/misc/README | modified | +109 −50 |
| src/include/utils/guc.h | modified | +11 −3 |
| src/include/utils/guc_tables.h | modified | +20 −19 |
| src/test/regress/expected/guc.out | modified | +141 −0 |
| src/test/regress/sql/guc.sql | modified | +64 −0 |