postgresql/src/include/utils
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
..
.gitignore Generate fmgr prototypes automatically 2017-01-17 14:06:07 -05:00
acl.h Replace AclObjectKind with ObjectType 2018-01-19 14:01:15 -05:00
aclchk_internal.h Replace GrantObjectType with ObjectType 2018-01-19 14:01:14 -05:00
array.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
arrayaccess.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
ascii.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
attoptcache.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
backend_random.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
builtins.h Fix some corner-case issues in REFRESH MATERIALIZED VIEW CONCURRENTLY. 2018-03-19 18:50:05 -04:00
bytea.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
cash.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catcache.h Save a few bytes by removing useless last argument to SearchCatCacheList. 2018-01-29 15:13:17 -05:00
combocid.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
date.h Fix compiler warnings due to commit cc4feded 2018-01-17 03:33:02 -05:00
datetime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
datum.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
dsa.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
dynahash.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
dynamic_loader.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
elog.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
evtcache.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
expandeddatum.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
expandedrecord.h Make plpgsql use its DTYPE_REC code paths for composite-type variables. 2018-02-13 18:52:21 -05:00
fmgrtab.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
formatting.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
freepage.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
geo_decls.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
guc.h Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c. 2018-03-21 20:03:28 -04:00
guc_tables.h Split out documentation of SSL parameters into their own section 2018-01-23 07:11:38 -05:00
hashutils.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
help_config.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
hsearch.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
index_selfuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
inet.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
int8.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
inval.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
json.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
jsonapi.h Centralize json and jsonb handling of datetime types 2018-01-16 19:07:13 -05:00
jsonb.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
logtape.h Support parallel btree index builds. 2018-02-02 13:32:44 -05:00
lsyscache.h Add prokind column, replacing proisagg and proiswindow 2018-03-02 13:48:33 -05:00
memdebug.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
memutils.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
nabstime.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
numeric.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
palloc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_crc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_locale.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_lsn.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pg_rusage.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
pidfile.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
plancache.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
portal.h Transaction control in PL procedures 2018-01-22 08:43:06 -05:00
ps_status.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
queryenvironment.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rangetypes.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
regproc.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rel.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
relcache.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
relfilenodemap.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
relmapper.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
relptr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
reltrigger.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
resowner.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
resowner_private.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
rls.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
ruleutils.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sampling.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
selfuncs.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sharedtuplestore.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
snapmgr.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
snapshot.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
sortsupport.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
spccache.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
syscache.h Save a few bytes by removing useless last argument to SearchCatCacheList. 2018-01-29 15:13:17 -05:00
timeout.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
timestamp.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tqual.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
tuplesort.h Support parallel btree index builds. 2018-02-02 13:32:44 -05:00
tuplestore.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
typcache.h Make plpgsql use its DTYPE_REC code paths for composite-type variables. 2018-02-13 18:52:21 -05:00
tzparser.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
uuid.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
varbit.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
varlena.h Update copyright for 2018 2018-01-02 23:30:12 -05:00
xml.h Update copyright for 2018 2018-01-02 23:30:12 -05:00