jian he <jian.universality@gmail.com> writes:
> On Mon, Apr 6, 2026 at 4:15 AM Tom Lane <tgl@sss.pgh.pa.us> 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