pgsql: Revise the API for GUC variable assign hooks.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Revise the API for GUC variable assign hooks.
Date: 2011-04-07 04:12:42
Message-ID: E1Q7gaI-00053n-6l@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Revise the API for GUC variable assign hooks.

The previous functions of assign hooks are now split between check hooks
and assign hooks, where the former can fail but the latter shouldn't.
Aside from being conceptually clearer, this approach exposes the
"canonicalized" form of the variable value to guc.c without having to do
an actual assignment. And that lets us fix the problem recently noted by
Bernd Helmle that the auto-tune patch for wal_buffers resulted in bogus
log messages about "parameter "wal_buffers" cannot be changed without
restarting the server". There may be some speed advantage too, because
this design lets hook functions avoid re-parsing variable values when
restoring a previous state after a rollback (they can store a pre-parsed
representation of the value instead). This patch also resolves a
longstanding annoyance about custom error messages from variable assign
hooks: they should modify, not appear separately from, guc.c's own message
about "invalid parameter value".

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2594cf0e8c04406ffff19b1651c5a406d376657c

Modified Files
--------------
contrib/auth_delay/auth_delay.c | 3 +-
contrib/auto_explain/auto_explain.c | 6 +
contrib/pg_stat_statements/pg_stat_statements.c | 4 +
contrib/sepgsql/hooks.c | 2 +
src/backend/access/transam/xlog.c | 96 +-
src/backend/catalog/namespace.c | 45 +-
src/backend/commands/tablespace.c | 85 +-
src/backend/commands/variable.c | 906 +++++-----
src/backend/nls.mk | 5 +-
src/backend/replication/syncrep.c | 14 +-
src/backend/tcop/postgres.c | 28 +-
src/backend/utils/adt/datetime.c | 33 +-
src/backend/utils/adt/pg_locale.c | 97 +-
src/backend/utils/cache/ts_cache.c | 32 +-
src/backend/utils/error/elog.c | 56 +
src/backend/utils/mb/mbutils.c | 145 +-
src/backend/utils/misc/README | 203 ++-
src/backend/utils/misc/guc-file.l | 22 +-
src/backend/utils/misc/guc.c | 2276 ++++++++++++++---------
src/backend/utils/misc/tzparser.c | 152 +-
src/include/commands/variable.h | 39 +-
src/include/mb/pg_wchar.h | 3 +-
src/include/replication/syncrep.h | 2 +-
src/include/tcop/tcopprot.h | 3 +-
src/include/tsearch/ts_cache.h | 3 +-
src/include/utils/datetime.h | 16 +-
src/include/utils/elog.h | 9 +
src/include/utils/guc.h | 77 +-
src/include/utils/guc_tables.h | 34 +-
src/include/utils/pg_locale.h | 16 +-
src/include/utils/tzparser.h | 4 +-
src/pl/plperl/plperl.c | 8 +-
src/pl/plpgsql/src/pl_handler.c | 2 +-
src/test/regress/expected/guc.out | 3 +-
src/timezone/pgtz.c | 36 +-
35 files changed, 2611 insertions(+), 1854 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-04-07 06:35:29 pgsql: Fix collations when we call transformWhereClause from outside th
Previous Message User Fxjr 2011-04-07 02:15:21 npgsql - Npgsql2: [#1010977] Add application_name support to connection