Re: BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators - Mailing list pgsql-bugs

From David Rowley
Subject Re: BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators
Date
Msg-id CAApHDvrDJ=bA0dTrcUs92Eg_gXO2DudjVJryiKLHR007L9SJhw@mail.gmail.com
Whole thread Raw
In response to BUG #19372: Scan operator maybe output unnecessary columns to the upper-layer operators  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Wed, 7 Jan 2026 at 23:39, 贾耀 <yaojia_0809@163.com> wrote:
I debugged the behavior of the statement using gdb, part of stack is:
#0 create_scan_plan
#1 create_plan_recurse
#2 create_projection_plan
#3 create_plan_recurse
#4 create_agg_plan
...
I think the point is flags in create_plan.
In frame 4, it give the flags CP_LABLE_TLIST; so use_physical_tlist of create_projection_plan return true in frame 2, and give the flags 0; so use_physical_tlist of create_scan_plan return true in frame 0, and build tlist with build_physical_tlist rather than build_path_tlist. build_physical_tlist will build all columns of table, build_path_tlist will build necessary columns with best_path's path target.

If I force it to go through build_path_tlist, I can get the simplified output of seqscan(just hjid and rjid)

So, it's a bug about flags? Will you fix it?

I've already mentioned, the current behaviour is intentional. So there are no changes to be made.

By all means, try your flag hack locally and see if performance is better or worse.

David

pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: Bug Report: PostgreSQL 16 crashes on ALTER USER CURRENT_USER WITH PASSWORD
Next
From: surya poondla
Date:
Subject: Re: BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work