Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Postgres hackers <pgsql-hackers@postgresql.org>
Date: 2018-01-12T01:24:40Z
Lists: pgsql-hackers
Attachments
- guc-list-track-v1.patch (text/plain) patch v1
On Thu, Jan 11, 2018 at 10:42:38AM -0500, Tom Lane wrote: > Michael Paquier <michael.paquier@gmail.com> writes: >> guc.c already holds a find_option() >> which can be used to retrieve the flags of a parameter. What about using >> that and filtering by GUC_LIST_INPUT? This requires exposing the >> function, and I am not sure what people think about that. > > Don't like exposing find_option directly, but I think it would make > sense to provide an API along the lines of > int GetConfigOptionFlags(const char *name, bool missing_ok). OK, I can live with that. What do you think about the attached? I'll be happy to produce patches for back-branches as necessary. When an option is not found, I have made the function return 0 as value for the flags, which is consistent with flatten_set_variable_args(). To make things behave more consistently with GUC_LIST_QUOTE GUCs, it seems to me that those should not be quoted as well (ALTER SYSTEM shares the same compatibility). And attached is a patch. While reviewing more the code, I have noticed the same code pattern in pg_dump.c and pg_dumpall.c. In the patch attached, I have corrected things so as all parameters marked as GUC_LIST_QUOTE are correctly not quoted because we have no generic solution to know from frontends what's a GUC type (it would make sense to me to expose a text[] with this information in pg_settings). However, let's be honest, it does not make sense to update all those parameters because who is really going to use them for functions! Two things that make sense to me are just wal_consistency_checking and synchronous_standby_names for developers which could use it to tune WAL generated within a set of SQL or plpgsql functions. As it is easier to delete than add code here, I have added all of them to ease the production of a committable version. For correctness, still having them may make sense. -- Michael
Commits
-
Prevent extensions from creating custom GUCs that are GUC_LIST_QUOTE.
- 846b5a525746 11.0 landed
-
Fix mishandling of quoted-list GUC values in pg_dump and ruleutils.c.
- be677bb5aa79 9.3.23 landed
- a35d72923165 9.5.13 landed
- 8132f0f3856d 9.6.9 landed
- 742869946f4f 11.0 landed
- 67e02cde7373 9.4.18 landed
- 66e92878aaec 10.4 landed