Re: some namespace.c refactoring

From: Noah Misch <noah(at)leadboat(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: some namespace.c refactoring
Date: 2023-02-16 04:36:16
Message-ID: 20230216043616.GB2385625@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 14, 2023 at 02:32:04PM +0100, Peter Eisentraut wrote:
> Notes on 0001-Refactor-is-visible-functions.patch:
>
> Among the functions that are being unified, some check temp schemas and some
> skip them. I suppose that this is because some (most) object types cannot
> normally be in temp schemas, but this isn't made explicit in the code. I
> added a code comment about this, the way I understand it.
>
> That said, you can create objects explicitly in temp schemas, so I'm not
> sure the existing code is completely correct.

> + /*
> + * Do not look in temp namespace for object types that don't
> + * support temporary objects
> + */
> + if (!(classid == RelationRelationId || classid == TypeRelationId) &&
> + namespaceId == myTempNamespace)
> + continue;

I think the reason for the class-specific *IsVisible behavior is alignment
with the lookup rules that CVE-2007-2138 introduced (commit aa27977). "CREATE
FUNCTION pg_temp.f(...)" works, but calling the resulting function requires a
schema-qualified name regardless of search_path. Since *IsVisible functions
determine whether you can reach the object without schema qualification, their
outcomes shall reflect those CVE-2007-2138 rules.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Samokhvalov 2023-02-16 04:38:01 Re: [PATCH] Add pretty-printed XML output option
Previous Message Noah Misch 2023-02-16 04:34:04 Re: run pgindent on a regular basis / scripted manner