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 1w9aGy-001YsX-1t for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 03:05:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9aGv-006E5C-1w for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 03:05:06 +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 1w9aGv-006E52-0z for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 03:05:05 +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 1w9aGo-00000000pkK-0nMR for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 03:05:00 +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 63634tr21199007; Sun, 5 Apr 2026 23:04:55 -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> <3819788.1775241322@sss.pgh.pa.us> <841583.1775414546@sss.pgh.pa.us> <944307.1775420103@sss.pgh.pa.us> Comments: In-reply-to jian he message dated "Mon, 06 Apr 2026 10:29:05 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1199005.1775444695.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Sun, 05 Apr 2026 23:04:55 -0400 Message-ID: <1199006.1775444695@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk jian he writes: > On Mon, Apr 6, 2026 at 4:15 AM Tom Lane wrote: >> I rewrote 0002 rather heavily, mainly because it assumed it could >> scribble on the input query tree which I don't think is okay. > But there is still no explanation about why it's not ok to scribble on > the input query tree. Because it might be in a cached plan tree and thus subject to being re-used. Now, you could sort of get away with that as long as whatever changes you make are idempotent. But palloc'ing new nodes in the current memory context and then putting links to them into the possibly-longer-lived source tree will not work. On the whole I think it'd be too fragile. See also [1]. I didn't get a chance to make that happen during v19, but it's still on the radar, and once it happens this sort of shortcut would definitely fail. > it would be better change to > + errmsg("CREATE specifies a schema (%s) different from the one being > created (%s)", > It's better for regex pattern searching, for new line you need to know > how to escape. I made it look the same as the existing copy of the message. I'm not too worried about the line break where it is; I doubt anyone would be doing a code search that would fail because of that. Breaking in the middle of either phrase of the message would be bad, agreed. regards, tom lane [1] https://www.postgresql.org/message-id/2531459.1743871597%40sss.pgh.pa.us