Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs
От | Michael Paquier |
---|---|
Тема | Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs |
Дата | |
Msg-id | 20180112012440.GA2222@paquier.xyz обсуждение исходный текст |
Ответ на | Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: pg_get_functiondef forgets about most GUC_LIST_INPUT GUCs
|
Список | pgsql-hackers |
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
Вложения
В списке pgsql-hackers по дате отправления: