Subject: Re: [17] Special search_path names "!pg_temp" and "!pg_catalog"

From: Nathan Bossart <[email-masked]>
Date: Thu, 26 Oct 2023 16:28:32 -0500

On Fri, Aug 18, 2023 at 02:44:31PM -0700, Jeff Davis wrote:
> +    SET search_path = admin, "!pg_temp";

I think it's unfortunate that these new identifiers must be quoted.  I
wonder if we could call these something like "no_pg_temp".  *shrug*

> +	 * Add any implicitly-searched namespaces to the list unless the markers
> +	 * "!pg_catalog" or "!pg_temp" are present.  Note these go on the front,
> +	 * not the back; also notice that we do not check USAGE permissions for
> +	 * these.
>  	 */
> -	if (!list_member_oid(oidlist, PG_CATALOG_NAMESPACE))
> +	if (implicit_pg_catalog &&
> +		!list_member_oid(oidlist, PG_CATALOG_NAMESPACE))
>  		oidlist = lcons_oid(PG_CATALOG_NAMESPACE, oidlist);
>  
> -	if (OidIsValid(myTempNamespace) &&
> +	if (implicit_pg_temp &&
> +		OidIsValid(myTempNamespace) &&
>  		!list_member_oid(oidlist, myTempNamespace))
>  		oidlist = lcons_oid(myTempNamespace, oidlist);

Should we disallow including both !pg_temp and pg_temp at the same time?  I
worry that could be a source of confusion.  IIUC your patches effectively
ignore !pg_temp if pg_temp is explicitly listed elsewhere in the list.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com