Re: Identity projection - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Identity projection
Date
Msg-id 20033.1360345007@sss.pgh.pa.us
Whole thread Raw
In response to Re: Identity projection  (Amit Kapila <amit.kapila@huawei.com>)
Responses Re: Identity projection  (Amit kapila <amit.kapila@huawei.com>)
List pgsql-hackers
Amit Kapila <amit.kapila@huawei.com> writes:
> On Friday, February 08, 2013 12:00 AM Tom Lane wrote:
> As per my understanding, currently in code wherever Result node can be
> avoided, 
> it calls function is_projection_capable_plan(), so we can even enhance
> is_projection_capable_plan()
> so that it can also verify the expressions of tlists. But for this we need
> to change at all places 
> from where is_projection_capable_plan() is called.

Hm.  Really there's a whole dance that typically goes on, which is like
               if (!is_projection_capable_plan(result_plan))               {                   result_plan = (Plan *)
make_result(root,                                                     sub_tlist,
             NULL,                                                      result_plan);               }
else              {                   /*                    * Otherwise, just replace the subplan's flat tlist with
              * the desired tlist.                    */                   result_plan->targetlist = sub_tlist;
     }
 

Perhaps we could encapsulate this whole sequence into a function called
say assign_targetlist_to_plan(), which would have the responsibility to
decide whether a Result node needs to be inserted.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Time for an autoconf update
Next
From: Josh Berkus
Date:
Subject: Re: Considering Gerrit for CFs