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 1tIAC4-00Cb6Z-RB for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2024 17:26:45 +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 1tIAC1-001w27-Pz for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2024 17:26:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIAC1-001w1x-5U for pgsql-hackers@lists.postgresql.org; Mon, 02 Dec 2024 17:26:42 +0000 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tIABv-000glQ-LX for pgsql-hackers@lists.postgresql.org; Mon, 02 Dec 2024 17:26:41 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id BEE951BF204; Mon, 2 Dec 2024 17:26:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=postgresfriends.org; s=gm1; t=1733160394; 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=mebq9RM/157mYZzZpxj7wEdfGCSVooCemECJFDKfH7M=; b=UpyGzgePMTVnfjuqrvpLjvekk+BkFYM1woAdCW/cEa1R55OXGC2wqK+z8luXBXKJhunan1 TI3OO4ptmKfdIwHw0/fiJ1G9MrVT1WsNwrwC7AnWb4LKQWW4mwkKHPjcC5RDmISRrUOx8t J9sWv4j6daNUcu/uipHeKwRat1sw14XGcIjufzMibHusyK87zJRp9lFdwXiTZT+cW59ZZi cik0xGhNGE7v7nOh83E05Uoo2KErw5Jn+FOsQIlPovhRcR5XVrX2J+9W2+UFR9u82MIva6 tPRJ4iQu1BxYxjEnaDhxk6GF6U0ioBqLJkrCxSmwkQhA41Cudf0jE990SBOYQA== Message-ID: <5b918548-605a-40c0-9ff0-82038608ab7c@postgresfriends.org> Date: Mon, 2 Dec 2024 18:26:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support To: Tom Lane Cc: Michael Paquier , 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> <5a329e21-2f07-4ec7-bcbf-32b9445ed127@postgresfriends.org> <1645311.1733158576@sss.pgh.pa.us> Content-Language: en-US From: Vik Fearing In-Reply-To: <1645311.1733158576@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 17:56, Tom Lane wrote: > Vik Fearing writes: >> On 02/12/2024 03:15, Tom Lane wrote: >>> 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 > path specification> and it says, "The paper is proposing the use of >> paths only to resolve unqualified routine invocations." > Interesting. The standard actually does say that that is what it is for. Section 11.1 SR 8: "The of the explicit or implicit is used as the SQL- path of the schema. The SQL-path is used to effectively qualify unqualified s that are immediately contained in s that are contained in the ." > But still, the spec allows within > , so even that narrow interpretation opens them > to the is-this-an-external-reference-or-a-forward-reference problem. Surely that is determined by the placement of the schema in its own SQL-path. > For us, that's clouded further for functions by our overloading rules. > If foo(bigint) exists in the search path, and we have a view or > whatever that references foo() with an int argument, and there is a > CREATE FUNCTION for foo(float8) later in the , what > are we supposed to think is the user's intent? (Just to save people > doing the experiment: we'd prefer foo(float8) if both are visible, > but foo(bigint) would be perfectly acceptable if not. Other choices > of the argument types would yield different results, and none of them > seem especially open-and-shut to me.) My answer is the same as above, for unqualified names. However, since there is nothing that says anything either way about forward references, my preference is to just execute them all in the order written.  In your example, that would mean choosing otherschema.foo(bigint) over thisschema.foo(float8) if the latter hasn't been created yet. > I don't know offhand if the > spec allows function overloading in the same way. Feature T-321 has a note saying, "Support for overloaded functions and procedures is not part of Core SQL." -- Vik Fearing