Richard Guo <[email protected]> writes:
> On Mon, Feb 23, 2026 at 11:48 PM Tom Lane <[email protected]> wrote:
>> How can that possibly be safe?
> Ugh. I'm not sure what I was thinking there. Deleting an RTE from
> the middle of the rtable is definitely taboo, as it shifts the indexes
> and can silently corrupt any Var nodes in the query tree that
> reference those later RTEs. Also, relying on the RTE_GROUP happening
> to be the last entry in the list is extremely fragile and just trouble
> waiting to happen.
Exactly. I'm not sure it's actively broken now (I spent a bit of
effort looking for a counterexample, and didn't find one), but it's
really far too fragile.
> Attached is the patch that converts the RTE into an RTE_RESULT.
LGTM.
regards, tom lane