I've noticed that the dummypp field of ProjectionPath is set but never read.

If the only possible change between the path and plan creation time is that
the projection path and the subpath targetlists become different, then dummypp
could be used this way:

diff --git a/src/backend/optimizer/plan/createplan.c 
b/src/backend/optimizer/plan/createplan.c
new file mode 100644
index 5c934f2..1910d3f
*** a/src/backend/optimizer/plan/createplan.c
--- b/src/backend/optimizer/plan/createplan.c
*************** create_projection_plan(PlannerInfo *root
*** 1572,1578 ****
         * not using.)
         */
        if (is_projection_capable_path(best_path->subpath) ||
!               tlist_same_exprs(tlist, subplan->targetlist))
        {
                /* Don't need a separate Result, just assign tlist to subplan */
                plan = subplan;
--- 1572,1578 ----
         * not using.)
         */
        if (is_projection_capable_path(best_path->subpath) ||
!               (best_path->dummypp && tlist_same_exprs(tlist, 
subplan->targetlist)))
        {
                /* Don't need a separate Result, just assign tlist to subplan */
                plan = subplan;


On the other hand, if the targetlists can also be different at path creation
time and equal at plan creation time, the lists do always need comparison at
plan creation time and the dummypp field should probably be removed.


-- 
Antonin Houska
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt
Web: http://www.postgresql-support.de, http://www.cybertec.at


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to