Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tI8yU-00CSjG-Lj for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2024 16:08:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tI8yS-00105z-41 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2024 16:08:37 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tI8yR-00102R-7f for pgsql-hackers@lists.postgresql.org; Mon, 02 Dec 2024 16:08:37 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tI8yO-000fyR-V2 for pgsql-hackers@lists.postgresql.org; Mon, 02 Dec 2024 16:08:35 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 5A7CFE0008; Mon, 2 Dec 2024 16:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=postgresfriends.org; s=gm1; t=1733155708; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qMyWSCVpbzWIxvsg5y8udETr75GGf9eAtPpjzrgMXg8=; b=AQR0PZ6K75JlEugJ3NPlmNovha+GyD4T1LtVy9qrCtUUoFO7v4+IMnYIknoOD4eh7UiXVO qZWqSE4Dzt27rWNwRjsLnacWlzijh4jDUyFgWop90PTOhFaQMwgRn+wRXTRzY1994TpUxf osDToWRmEmN0mozfrHAvUxjGFiSoGSkQjsM76LYiEgDMAxD1lD0rwMmpdBTO+9QXghCSH7 8rnhs2F0REa8UaABe0PDlH7FOc5ky/aLzfTCAyO845H9QYbmsyXixDSwZNovHJOwHUMN0M XoaYN8Sqp4c+ypv4DY6lEUOPH/6kjtjC+98DgSKX5CM2JCkB5bZ7ac8ZYsCUSg== Message-ID: <5a329e21-2f07-4ec7-bcbf-32b9445ed127@postgresfriends.org> Date: Mon, 2 Dec 2024 17:08:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support To: Tom Lane , Michael Paquier Cc: jian he , Kirill Reshke , Peter Eisentraut , PostgreSQL Hackers References: <2007224.1732773174@sss.pgh.pa.us> <1075425.1732993688@sss.pgh.pa.us> <1220935.1733009604@sss.pgh.pa.us> <1273964.1733032384@sss.pgh.pa.us> <1353043.1733072243@sss.pgh.pa.us> <1488327.1733092220@sss.pgh.pa.us> <1525354.1733105723@sss.pgh.pa.us> Content-Language: en-US From: Vik Fearing In-Reply-To: <1525354.1733105723@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-GND-Sasl: vik@postgresfriends.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 02/12/2024 03:15, Tom Lane wrote: > Michael Paquier 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 is not specified, then a path specification> containing an implementation-defined name list> that contains the contained in 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 at all. I looked up the original paper (MUN-051) that introduced the 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 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