On Fri, Dec 22, 2023 at 2:38 AM Heikki Linnakangas <hlinn...@iki.fi> wrote:

> v1-0004-Omit-columns-from-final-tlist-that-were-only-need.patch
>
> The main patch in this series.


This patch filters out the junk columns created for ORDER BY/GROUP BY,
and retains the junk columns created for RowLocks.  I'm afraid this may
have a problem about out-of-order resnos.  For instance,

create table mytable (foo text, bar text);

# explain select foo from mytable order by bar for update of mytable;
server closed the connection unexpectedly

This query triggers another Assert in apply_tlist_labeling:

    Assert(dest_tle->resno == src_tle->resno);

At first there are three TargetEntry items: foo, bar and ctid, with
resnos being 1, 2 and 3.  And then the second item 'bar' is removed,
leaving only two items: foo and ctid, with resnos being 1 and 3.  So now
we have a missing resno, and finally hit the Assert.

Thanks
Richard

Reply via email to