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 1x2YJv-005pl4-0b for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2026 18:07:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x2YJu-0084FI-01 for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Sep 2026 18:07:22 +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 1x2YJt-0084FA-1X for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2026 18:07:21 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1x2YJq-00000002x9y-1JAo for pgsql-hackers@lists.postgresql.org; Fri, 04 Sep 2026 18:07:21 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-2d5cad1a6baso12572575ad.3 for ; Fri, 04 Sep 2026 11:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1788545236; x=1789150036; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-disposition:content-type :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=urX892A4WaHs+l1ljzHZKiqGTItlcwctzq4uFsXDMuI=; b=Tm5jgQlDkkDYuXo/s5uPBDQ5OAGfbT9n9BMpIVEn8vx3VC7a+Aldpfm1+J85tyxJEc W1rXvYdhj2KI0t5tulPZC82BTWDibkIkLfbilAr1v3cFK6dEtaMCa/1GBZFA/J4zVx0q fhBafsNcCYpu6/Q7c92O6eZjIjiqOWb+uDZq4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788545236; x=1789150036; h=user-agent:in-reply-to:content-disposition:content-type :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=urX892A4WaHs+l1ljzHZKiqGTItlcwctzq4uFsXDMuI=; b=YpYojkfu6/bAb3JRvJyH2IrN+VtlSRCISie3oVkduZxtqDZpPfvC+4btx5FPNXWTaJ kcY/gtqhZ0EL8WoV4t9WkF9xr/TBS8BtGcbUT8fQOheQX8Un+BeKGi5UmDFcoQY4Utnm 82dGacf8E/K2Dxs5gKXySA+FPUOkl1bd4Xv/7pyOZuqxvSFdxm5LQ3Cf3WYrP4xKiGhG xHjkASdkbKz/Zk/z6LYWvPNJEmg2g+BldOuEASAe/xEXIlp2/nVJ+SMUuDotl/ZqWPEw ftLsuRJ97FRd1HqbFjwkCQshp9v0R6wUvtOOyRAw3SvkAs1YePBIyLvpMuVfuXR3hFxV kwcg== X-Forwarded-Encrypted: i=1; AKwUvBz32AsAtyZP2h2fccQPbFJd0K101VpUpS64Y4r1NYvvoZN59hrUgbmQi/x4pSTQZy30DGfGDwRrR4/Gdi5b@lists.postgresql.org X-Gm-Message-State: AFuF++lOdeQQ1Z3Rkt23GDu0qxaDpBznqyh4QGN4xdv7vgzdTb8klhRU FvjJLCF4v3EfHe7/8TUa3KxFbR4eoiB8L2XyNV2Ak4tC17Ah5mm+BzmjnvLylsW9xSEzHRDtdcN ahfU= X-Gm-Gg: AYBFou0ii709NY1zt1yI0HNIc9I7zibehK5xoYbIHF8ogl7pnjzj9mfj3Cy9TSXOpA6 6464tizQ2vYqycTN0EQHEh9bNKHw+YxFcpYHYYWePKyiQoS/70N4uWyzbHLREvweFlYzNYG2ueA fV+rY8kgtt6ph9R6bPZMkJ/Rtv2Z3Ihz0oaFwOp6YE0Pcpg1soTJ4S+Hoo3sjBEt5VNgi3Lr3WB ypH8rFzlFKHUwSTPWoys0TMvVS7I8XMDOkwrDkJ563E04RsAOLAHSFufySLxeBg+WYg2Egl/ZCe uRestzUVtgC5/xcB+idEjSVIQxBQKeUSc6yI5nx1hNuD5TB7LwDGuKaLnbaPkNt0OLZ4kb6b3Lf /THp3lUm6aLmVZdOeh4S4CvMmt+mpv/ksffHRwhk64nZUa4tkkdhsUrEb0EiI9cMjKFWy9oKJ9B AUkon1gkMU3HOBv4hJG4vVN9md5jHvItJ7zjV4LUX3faqacd6fK4BU7tRUXIE0naxVQLd7aD3g5 s0jlXeVxwnBPY4Vjcja X-Received: by 2002:a17:90b:33c9:b0:398:c16e:69d3 with SMTP id 98e67ed59e1d1-39b26122fbamr10963107a91.1.1788545235458; Fri, 04 Sep 2026 11:07:15 -0700 (PDT) Received: from microsoft.com (c-73-15-160-255.hsd1.ca.comcast.net. [73.15.160.255]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3339b123731sm7734451eec.18.2026.09.04.11.07.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Sep 2026 11:07:14 -0700 (PDT) Date: Fri, 4 Sep 2026 11:07:12 -0700 From: Noah Misch To: Tom Lane Cc: jian he , Kirill Reshke , Peter Eisentraut , PostgreSQL Hackers Subject: Re: CREATE SCHEMA ... CREATE DOMAIN support Message-ID: <20260904180712.cc.noahmisch@microsoft.com> References: <3819788.1775241322@sss.pgh.pa.us> <841583.1775414546@sss.pgh.pa.us> <944307.1775420103@sss.pgh.pa.us> <1199006.1775444695@sss.pgh.pa.us> <1838711.1775503188@sss.pgh.pa.us> <20260904002924.a7.noahmisch@microsoft.com> <1504966.1788483626@sss.pgh.pa.us> <20260904035154.0b.noahmisch@microsoft.com> <1566169.1788531712@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1566169.1788531712@sss.pgh.pa.us> User-Agent: Mutt/2.3.0 (2026-01-25) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Sep 04, 2026 at 10:21:52AM -0400, Tom Lane wrote: > Noah Misch writes: > > On Thu, Sep 03, 2026 at 09:00:26PM -0400, Tom Lane wrote: > >> This is not about that, it is about a9c350d's specific intent "Don't > >> try to re-order the subcommands of CREATE SCHEMA". That is, we > >> rejected the idea of allowing forward references between CREATE SCHEMA > >> subcommands, therefore myview will not bind to a CREATE TABLE > >> subcommand that comes after it. > > > I'm not saying that I want the server to reorder the commands or that I know > > of a standard requiring reorder. I'm fine requiring the user to order things > > for us. The syntax rule I cited[1] appears to require my original example to > > have the same name resolution as this variant w/ more schema qualifications: > > > CREATE TABLE public.mytable (c int); > > CREATE SCHEMA myschema > > CREATE VIEW myschema.myview AS SELECT * FROM myschema.mytable > > CREATE TABLE myschema.mytable (c int); > > SET search_path = pg_catalog; > > \d+ myschema.myview > > RESET search_path; > > > That succeeds in v18 and fails in v19, which is fine. The problem is that my > > original example (with less schema qualification) succeeds in both versions > > with different meaning, and the v19 meaning is not standard-compliant. > > What would you have us do differently? I recommend reverting the v19 CREATE SCHEMA changes, unfortunately. The thread started with what smelled like low-hanging fruit: let users write "CREATE SCHEMA myschema CREATE DOMAIN mydomain" instead of "CREATE SCHEMA myschema; CREATE DOMAIN myschema.mydomain". That led to a9c350d silently changing the meaning of CREATE SCHEMA statements that v18 already accepts. Since the benefit of supporting "CREATE SCHEMA myschema CREATE DOMAIN mydomain" is so modest, it doesn't take much of a problem to outweigh that benefit. > As near as I can tell, the spec's wording is untenable anyway: it > appears to say that names within a CREATE SCHEMA can never refer to > objects outside the new schema unless explicitly schema-qualified. > Half a moment's thought shows that that's unworkable for Postgres: > > CREATE SCHEMA s1 > CREATE TABLE t1 (f1 int) > CREATE VIEW v1 AS SELECT abs(f1) AS a, f1 + 1 AS b FROM t1; > > With that interpretation, both this reference to pg_catalog.abs() > and this reference to operator(pg_catalog.+) must fail. I don't > think anyone's going to consider that behavior better. But as > soon as you admit that "oh, pg_catalog must be implicitly in the > search path too", you might as well admit that our existing behavior > where the whole search_path is implicitly available is okay. It's a tarpit for sure. I don't think the benefit of supporting more object types in CREATE SCHEMA warrants sorting all of that out. Let's just keep writing multiple SQL statements.