Re: BUG #16376: ALTER SYSTEM incorrectly quotes empty list

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: tejeswarm(at)hotmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #16376: ALTER SYSTEM incorrectly quotes empty list
Date: 2020-04-18 01:35:51
Message-ID: 14102.1587173751@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Fri, Apr 17, 2020 at 2:21 PM PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
>> 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 = '';

> Well, its their bug, not ours, given that we specify two valid ways to
> accomplish this goal. SET TO DEFAULT, and RESET.

Yes, this is *not* a bug, it's acting as designed. That syntax does
not result in a zero-length list, it results in a list with one
empty-string entry. We have the same behavior with search_path, which
is parsed in the same way. (It's somewhat masked for search_path by
the decision to ignore entries that correspond to nonexistent schemas.)

There are things we might want to do about this. It's somewhat
unfortunate that there's no way to set a GUC_LIST_INPUT variable to an
empty list in SET (since RESET might not do that, depending on what the
default value is). And perhaps we ought to try harder to validate
shared_preload_libraries and its ilk when they are set. But I disagree
that there's any parsing bug in the case at hand.

Another thing that's rather unfortunate is that the syntax is
different in postgresql.conf than it is in SQL --- in a config
file, setting shared_preload_libraries = '' *does* set it to
an empty list. Which may have contributed to the thinko here.
But I'm afraid we're a decade or two too late to redefine the
config file syntax.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2020-04-18 02:13:17 Re: BUG #16369: Segmentation Faults and Data Corruption with Generated Columns
Previous Message David G. Johnston 2020-04-17 22:56:40 Re: BUG #16376: ALTER SYSTEM incorrectly quotes empty list