pgsql: Improve and simplify CREATE EXTENSION's management of GUC variab

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Improve and simplify CREATE EXTENSION's management of GUC variab
Дата
Msg-id E1RBc4h-0001Sb-Sa@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ba6f629326be365a3124dc80aa5d303e2b0bf46b

Modified Files
--------------
src/backend/commands/extension.c    |   40 +++++++++++-----------------------
src/backend/utils/adt/ri_triggers.c |   20 +++++++---------
src/backend/utils/misc/guc.c        |   20 +++++++++-------
src/include/utils/guc.h             |    2 +-
4 files changed, 34 insertions(+), 48 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve and simplify CREATE EXTENSION's management of GUC variab
Следующее
От: mhasegawa@pgfoundry.org (User Mhasegawa)
Дата:
Сообщение: pgbulkload - pgbulkload: Support PostgreSQL 9.1