Re: Seems to be impossible to set a NULL search_path

From: Bryn Llewellyn <bryn(at)yugabyte(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Christophe Pettus <xof(at)thebuild(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Seems to be impossible to set a NULL search_path
Date: 2022-07-05 19:05:01
Message-ID: 51E0A66E-C09E-4F6F-8B53-BBB83F810F90@yugabyte.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>> adrian(dot)klaver(at)aklaver(dot)com wrote:
>>>
>>> set search_path = '';
>>> show search_path ;
>>> search_path
>>> -------------
>>> ""
>> pavel(dot)stehule(at)gmail(dot)com
>>
>> ...But still in this case, there is pg_catalog in search path.
>
> Yes but from OP:
>
> « I've confirmed that even a superuser cannot create objects in a "special" schema like "pg_catalog" or "pg_toast". So this gives me a workaround to the limitation that I cannot force the use of fully qualified names by setting a null search_path: I could set the attribute of my subprogram to "pg_catalog". »
>
> So Bryn Llewellyn does not seem to be concerned about that.

Thanks, all, for your replies. I'd assumed that the arguments of "set search_path" had to be SQL names. so I tried "". But that caused an error. I didn't try the ordinary empty string because I'd assumed that, as an illegal SQL name, it would be illegal in "set search_path". Hmm...

I'm slightly troubled by "works right now":

> xof(at)thebuild(dot)com wrote:
>
> You use the empty string, rather than NULL... it works right now:

But because you experts all recommend it, I'll go with it. It's more expressive of what I mean than is using "pg_catalog".

(I'm assuming that having such an unwritable schema inevitably on the search_path is simply an entirely benign benefit. But it could give a strange message to the reader in my use case.)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-07-05 19:13:00 Re: Seems to be impossible to set a NULL search_path
Previous Message Andrew Dunstan 2022-07-05 18:52:57 Re: [UNVERIFIED SENDER] Re: pg_upgrade can result in early wraparound on databases with high transaction load