Re: Seems to be impossible to set a NULL search_path - Mailing list pgsql-general

From David G. Johnston
Subject Re: Seems to be impossible to set a NULL search_path
Date
Msg-id CAKFQuwbsg0M==0c3v8UUUrpFRH-V_MZS0Fbr-tueom4wcd5yqQ@mail.gmail.com
Whole thread Raw
In response to Re: Seems to be impossible to set a NULL search_path  (Christophe Pettus <xof@thebuild.com>)
List pgsql-general
On Wed, Jul 6, 2022 at 10:03 AM Christophe Pettus <xof@thebuild.com> wrote:


> On Jul 6, 2022, at 09:48, Bryn Llewellyn <bryn@yugabyte.com> wrote:
> Neither causes an error. The "show", in each case, prints the bare value with no quotes. It never struck me try try double quotes around the timezone argument. I'm shocked that they are silently accepted here and seem to have the same effect (in this syntax setting) as single quotes.

It's really a lot easier than it is being made out to be.

GUCs accept a string as a value, which might then be converted to other values based on the semantics of the GUC.  PostgreSQL generously accepts three different ways of delimiting this string:

1. Single quotes (as in SQL).
2. Double quotes (which in SQL, yes, are used to delimit names).
3. No delimiter at all if there are no embedded characters that would terminate the value prematurely.


4. Dollar quoting

postgres=# set search_path to $$testschema$$;
SET
postgres=# show search_path;
 search_path
-------------
 testschema
(1 row)

Thus a more accurate syntax specification would be (at least for search_path):

SET [ SESSION | LOCAL ] configuration_parameter { TO | = } value [, ...]

Where value is one of:
 { identifier | string_constant | DEFAULT }

And those first two are the defined terms in SQL Syntax.

That covers all four options split among the two defined types.

Now, maybe that doesn't work for other GUCs and so this level of imprecision is acceptable...I'm ok with coming away from this conversation with the status quo but I'm not going to try and claim there isn't anything confusing here.

David J.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Seems to be impossible to set a NULL search_path
Next
From: Karsten Hilbert
Date:
Subject: Re: lifetime of the old CTID