Re: CREATE SCHEMA ... CREATE DOMAIN support

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support
Date: 2024-12-02 16:08:26
Message-ID: 5a329e21-2f07-4ec7-bcbf-32b9445ed127@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 02/12/2024 03:15, Tom Lane wrote:
> Michael Paquier <michael(at)paquier(dot)xyz> writes:
>> If I'm parsing the spec right, the doc mentions in its 5)~6) of the
>> syntax rules in CREATE SCHEMA that non-schema-qualified objects should
>> use the new schema name defined in the CREATE SCHEMA query. So that
>> pretty much settles the rules to use when having a new object that has
>> a reference to a non-qualified object created in the same CREATE
>> SCHEMA query?
> I don't see where you're getting that from? DB2 says that unqualified
> reference names (not to be confused with unqualified creation-target
> names) are taken to be in the new schema, but I don't see any
> corresponding restriction in the spec.
>
> What I do see (11.1 SR 6 in SQL:2021) is:
>
> If <schema path specification> is not specified, then a <schema
> path specification> containing an implementation-defined <schema
> name list> that contains the <schema name> contained in <schema
> name clause> is implicit.
>
> What I read this as is that the "search path" during schema-element
> creation must include at least the new schema, but can also include
> some other schemas as defined by the implementation. That makes
> our behavior compliant, because we can define the other schemas
> as those in the session's prevailing search_path. (DB2's behavior
> is also compliant, but they're defining the path as containing only
> the new schema.)
>
> Also, if SQL intended to constrain the search path for unqualified
> identifiers to be only the new schema, they'd hardly need a concept
> of <schema path specification> at all.

I looked up the original paper (MUN-051) that introduced the <schema
path specification> and it says, "The paper is proposing the use of
paths only to resolve unqualified routine invocations."

That doesn't seem to have been explained much by the rest of the spec,
but it is visible in the definition of <path specification> which says,
"Specify an order for searching for an SQL-invoked routine."

I can find nowhere that says that the path can or cannot be used for
other objects.

--

Vik Fearing

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-12-02 16:31:48 Re: Incorrect result of bitmap heap scan.
Previous Message Peter Geoghegan 2024-12-02 16:07:38 Re: Incorrect result of bitmap heap scan.