BUG #16376: ALTER SYSTEM incorrectly quotes empty list
От | PG Bug reporting form |
---|---|
Тема | BUG #16376: ALTER SYSTEM incorrectly quotes empty list |
Дата | |
Msg-id | 16376-d2e5e5c8cbed7525@postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #16376: ALTER SYSTEM incorrectly quotes empty list
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 16376 Logged by: Teja Mupparti Email address: tejeswarm@hotmail.com PostgreSQL version: 11.0 Operating system: Linux Description: Some applications set Postgres parameters using GUI(s) Once a value is set and deselected later, it issues a SQL ALTER SYSTEM set shared_preload_libraries = ''; is translating into shared_preload_libraries = '""' in the postgresql.auto.conf, which will prevent Postgres server from starting (illegal value of "") FATAL: could not access file "": No such file or directory. The quick fix is in quote_identifier() change safe = ((ident[0] >= 'a' && ident[0] <= 'z') || ident[0] == '_'); to safe = ((ident[0] >= 'a' && ident[0] <= 'z') || ident[0] == '_' || ident[0] == '\0'); Which will avoid the unwnated double-quotes, but is opening a can of worms. Easy fix is in Alter system code path +#define EMPTY_QUOTES "\"\"" + /* * Precision with which REAL type guc values are to be printed for GUC * serialization. @@ -7886,6 +7888,22 @@ AlterSystemSetConfigFile(AlterSystemStmt *altersysstmt) FreeFile(infile); } + /* + * There is a special case where an empty list '' is getting + * translated into '""' by the quoted_identifier() logic. + * For example, set shared_preload_libraries = '' is written + * as shared_preload_libraries = '""' in the autoconfig file + * and the subsequent restart fails with the below error. + * + * FATAL: could not access file "": No such file or directory + * + * Fixing quoted_identifier() breaks other parts of the code, + * where it depends on translating '' to "". If the list is + * empty, set the value to NULL (this will remove the entry + * from the auto-config file) + */ + if (!strcmp(value, EMPTY_QUOTES)) + value = '\0'; --
В списке pgsql-bugs по дате отправления: