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.96) (envelope-from ) id 1w8jMh-000oxd-33 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 18:35:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8jMg-00DCNj-16 for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Apr 2026 18:35:30 +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.96) (envelope-from ) id 1w8jMg-00DCNa-0A for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2026 18:35:30 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w8jMe-00000000PxK-0D2Y for pgsql-hackers@lists.postgresql.org; Fri, 03 Apr 2026 18:35:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 633IZMma3819789; Fri, 3 Apr 2026 14:35:22 -0400 From: Tom Lane To: jian he cc: Kirill Reshke , Peter Eisentraut , PostgreSQL Hackers Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support In-reply-to: References: <1898722.1732732780@sss.pgh.pa.us> <2007224.1732773174@sss.pgh.pa.us> <1075425.1732993688@sss.pgh.pa.us> <345c20e5-a6d7-477a-9598-982661bb5740@eisentraut.org> <1990479.1733256458@sss.pgh.pa.us> <499425.1733936916@sss.pgh.pa.us> <685422.1756848241@sss.pgh.pa.us> Comments: In-reply-to jian he message dated "Wed, 17 Dec 2025 21:29:13 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3819787.1775241322.1@sss.pgh.pa.us> Date: Fri, 03 Apr 2026 14:35:22 -0400 Message-ID: <3819788.1775241322@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote [ many months ago now ]: >> I think this is still kind of blocked, because it's not clear to me >> whether we have consensus about it being okay to do 0001. >> >> Re-reading the thread, the only real use-case for re-ordering that >> anyone proposed is that foreign key references should be able to be >> forward references to tables created later in the same CREATE SCHEMA. >> I concede first that this is a somewhat-plausible use-case and >> second that it is pretty clearly required by spec. The fact remains >> however that we have never supported that in two dozen years, and >> the number of complaints about the omission could be counted without >> running out of thumbs. So, how about the following plan of action? >> >> 1. Rip out subcommand re-ordering as currently implemented, and do the >> subcommands in the given order. >> >> 2. When a CREATE TABLE subcommand includes a FOREIGN KEY clause, >> transform that clause into ALTER TABLE ADD FOREIGN KEY, and push >> it to the back of the CREATE SCHEMA's to-do list. Nobody has complained about this approach since September, so unless there's a complaint PDQ, I'm going to take silence as consent and move forward with reviewing/applying Jian's patchset. regards, tom lane