pgsql: Improve define_custom_variable's handling of pre-existing settin

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve define_custom_variable's handling of pre-existing settin
Date: 2011-10-04 23:58:08
Message-ID: E1RBEsC-0005D7-8Z@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve define_custom_variable's handling of pre-existing settings.

Arrange for any problems with pre-existing settings to be reported as
WARNING not ERROR, so that we don't undesirably abort the loading of the
incoming add-on module. The bad setting is just discarded, as though it
had never been applied at all. (This requires a change in the API of
set_config_option. After some thought I decided the most potentially
useful addition was to allow callers to just pass in a desired elevel.)

Arrange to restore the complete stacked state of the variable, rather than
cheesily reinstalling only the active value. This ensures that custom GUCs
will behave unsurprisingly even when the module loading operation occurs
within nested subtransactions that have changed the active value. Since a
module load could occur as a result of, eg, a PL function call, this is not
an unlikely scenario.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/41e461d36fb1ef78494429f28ea4b72c759f419d

Modified Files
--------------
contrib/tsearch2/tsearch2.c | 14 +--
src/backend/commands/extension.c | 12 +-
src/backend/utils/adt/ri_triggers.c | 4 +-
src/backend/utils/misc/guc-file.l | 4 +-
src/backend/utils/misc/guc.c | 204 +++++++++++++++++++++++++++--------
src/include/utils/guc.h | 2 +-
6 files changed, 173 insertions(+), 67 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2011-10-05 01:47:52 pgsql: Explain COALESCE example in the docs.
Previous Message Tom Lane 2011-10-04 21:08:33 pgsql: Fix uninitialized-variable bug.