postgresql/src/backend/utils
Tom Lane 3d332c8f38 Improve and simplify CREATE EXTENSION's management of GUC variables.
CREATE EXTENSION needs to transiently set search_path, as well as
client_min_messages and log_min_messages.  We were doing this by the
expedient of saving the current string value of each variable, doing a
SET LOCAL, and then doing another SET LOCAL with the previous value at
the end of the command.  This is a bit expensive though, and it also fails
badly if there is anything funny about the existing search_path value,
as seen in a recent report from Roger Niederland.  Fortunately, there's a
much better way, which is to piggyback on the GUC infrastructure previously
developed for functions with SET options.  We just open a new GUC nesting
level, do our assignments with GUC_ACTION_SAVE, and then close the nesting
level when done.  This automatically restores the prior settings without a
re-parsing pass, so (in principle anyway) there can't be an error.  And
guc.c still takes care of cleanup in event of an error abort.

The CREATE EXTENSION code for this was modeled on some much older code in
ri_triggers.c, which I also changed to use the better method, even though
there wasn't really much risk of failure there.  Also improve the comments
in guc.c to reflect this additional usage.
2011-10-05 20:44:22 -04:00
..
adt Improve and simplify CREATE EXTENSION's management of GUC variables. 2011-10-05 20:44:22 -04:00
cache Fix a missed case in code for "moving average" estimate of reltuples. 2011-08-30 14:49:52 -04:00
error Reduce PG_SYSLOG_LIMIT to 900 bytes. 2011-08-05 21:02:52 -04:00
fmgr Replace errdetail("%s", ...) with errdetail_internal("%s", ...). 2011-07-16 14:22:35 -04:00
hash Fix the size of predicate lock manager's shared memory hash tables at creation. 2011-04-11 13:43:31 +03:00
init Fix incorrect timeout handling during initial authentication transaction. 2011-08-13 17:52:41 -04:00
mb Avoid possibly accessing off the end of memory in SJIS2004 conversion. 2011-09-06 14:50:44 -04:00
misc Improve and simplify CREATE EXTENSION's management of GUC variables. 2011-10-05 20:44:22 -04:00
mmgr Cleanup for pull-up-isReset patch. 2011-05-24 17:57:32 -04:00
resowner pgindent run before PG 9.1 beta 1. 2011-04-10 11:42:00 -04:00
sort Fix failure to account for memory used by tuplestore_putvalues(). 2011-06-15 14:05:39 -04:00
time Remove special case for xmin == xmax in HeapTupleSatisfiesVacuum(). 2011-04-29 16:29:42 -04:00
.gitignore Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
errcodes.txt Per-column collation support 2011-02-08 23:04:18 +02:00
Gen_dummy_probes.sed Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
Gen_fmgrtab.pl Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00
generate-errcodes.pl Avoid maintaining three separate copies of the error codes list. 2011-02-03 22:32:49 -05:00
Makefile Make handling of errcodes.h more consistent with other generated headers. 2011-02-04 09:29:10 -05:00
probes.d Stamp copyrights for year 2011. 2011-01-01 13:18:15 -05:00