postgresql/src/bin
Tom Lane 742869946f Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c.
Code that prints out the contents of setconfig or proconfig arrays in
SQL format needs to handle GUC_LIST_QUOTE variables differently from
other ones, because for those variables, flatten_set_variable_args()
already applied a layer of quoting.  The value can therefore safely
be printed as-is, and indeed must be, or flatten_set_variable_args()
will muck it up completely on reload.  For all other GUC variables,
it's necessary and sufficient to quote the value as a SQL literal.

We'd recognized the need for this long ago, but mis-analyzed the
need slightly, thinking that all GUC_LIST_INPUT variables needed
the special treatment.  That's actually wrong, since a valid value
of a LIST variable might include characters that need quoting,
although no existing variables accept such values.

More to the point, we hadn't made any particular effort to keep the
various places that deal with this up-to-date with the set of variables
that actually need special treatment, meaning that we'd do the wrong
thing with, for example, temp_tablespaces values.  This affects dumping
of SET clauses attached to functions, as well as ALTER DATABASE/ROLE SET
commands.

In ruleutils.c we can fix it reasonably honestly by exporting a guc.c
function that allows discovering the flags for a given GUC variable.
But pg_dump doesn't have easy access to that, so continue the old method
of having a hard-wired list of affected variable names.  At least we can
fix it to have just one list not two, and update the list to match
current reality.

A remaining problem with this is that it only works for built-in
GUC variables.  pg_dump's list obvious knows nothing of third-party
extensions, and even the "ask guc.c" method isn't bulletproof since
the relevant extension might not be loaded.  There's no obvious
solution to that, so for now, we'll just have to discourage extension
authors from inventing custom GUCs that need GUC_LIST_QUOTE.

This has been busted for a long time, so back-patch to all supported
branches.

Michael Paquier and Tom Lane, reviewed by Kyotaro Horiguchi and
Pavel Stehule

Discussion: https://postgr.es/m/20180111064900.GA51030@paquier.xyz
2018-03-21 20:03:28 -04:00
..
initdb Fix more format truncation issues 2018-03-15 11:41:42 -04:00
pg_archivecleanup pg_archivecleanup: Add test suite 2017-09-14 22:23:00 -04:00
pg_basebackup Fix pg_recvlogical for pre-10 versions 2018-03-18 13:08:25 +01:00
pg_config Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_controldata pg_controldata: Prevent division-by-zero errors 2018-03-21 12:21:23 -04:00
pg_ctl Support huge pages on Windows 2018-01-21 15:40:46 +01:00
pg_dump Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c. 2018-03-21 20:03:28 -04:00
pg_resetwal Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_rewind Fix pg_rewind to handle relation data files in tablespaces properly. 2018-03-06 02:08:18 +09:00
pg_test_fsync Make WAL segment size configurable at initdb time. 2017-09-19 22:03:48 -07:00
pg_test_timing pg_test_timing: Some NLS fixes 2017-08-26 09:25:19 -04:00
pg_upgrade Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:44 -08:00
pg_waldump Update copyright for 2018 2018-01-02 23:30:12 -05:00
pgbench Add general purpose hasing functions to pgbench. 2018-03-21 18:01:23 +03:00
pgevent Update copyright for 2018 2018-01-02 23:30:12 -05:00
psql Rename TransactionChain functions 2018-03-16 13:18:06 -04:00
scripts Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:44 -08:00
Makefile Update copyright for 2018 2018-01-02 23:30:12 -05:00