Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Andrei Klychkov <andrew(dot)a(dot)klychkov(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters
Date: 2025-09-02 12:16:08
Message-ID: 38091678-2820-4bc8-8df7-b417562f7860@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Andrew

On 28.08.25 11:29, Andrei Klychkov wrote:
> I'm submitting a patch to fix a bug where ALTER SYSTEM SET with empty
> strings for
> GUC_LIST_QUOTE parameters (like shared_preload_libraries) results in
> malformed
> configuration entries that cause server crashes on restart.

I tested the patch and it does what you described

$ psql postgres -c "ALTER SYSTEM SET shared_preload_libraries TO '';"
ALTER SYSTEM
$ cat /usr/local/postgres-dev/testdb/postgresql.auto.conf
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
shared_preload_libraries = ''

However, it breaks one of the rules.sql regression tests

@@ -3552,21 +3552,7 @@
     SET local_preload_libraries TO "Mixed/Case", 'c:/''a"/path', '',
'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
     IMMUTABLE STRICT;
 SELECT pg_get_functiondef('func_with_set_params()'::regprocedure);
-                                                                           
pg_get_functiondef                                                                          
 
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- CREATE OR REPLACE FUNCTION
public.func_with_set_params()                                                                                                               
+
-  RETURNS
integer                                                                                                                                                       
+
-  LANGUAGE
sql                                                                                                                                                          
+
-  IMMUTABLE
STRICT                                                                                                                                                      
+
-  SET search_path TO
'pg_catalog'                                                                                                                                       
+
-  SET extra_float_digits TO
'2'                                                                                                                                         
+
-  SET work_mem TO
'4MB'                                                                                                                                                 
+
-  SET "DateStyle" TO 'iso,
mdy'                                                                                                                                         
+
-  SET local_preload_libraries TO 'Mixed/Case', 'c:/''a"/path', '',
'0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'+
- AS $function$select
1;$function$                                                                                                                                       
+
-
-(1 row)
-
+ERROR:  invalid list syntax in proconfig item

Best, Jim

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alyona Vinter 2025-09-02 12:36:57 Re: Resetting recovery target parameters in pg_createsubscriber
Previous Message Shlok Kyal 2025-09-02 12:12:13 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart