Re: Wrong results with grouping sets

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Wrong results with grouping sets
Дата
Msg-id 4030683.1771964465@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Wrong results with grouping sets  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: Wrong results with grouping sets
Список pgsql-hackers
Richard Guo <guofenglinux@gmail.com> writes:
> On Mon, Feb 23, 2026 at 11:48 PM Tom Lane <tgl@sss.pgh.pa.us> 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



В списке pgsql-hackers по дате отправления: