Re: ERROR: ORDER/GROUP BY expression not found in targetlist - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: ERROR: ORDER/GROUP BY expression not found in targetlist
Date
Msg-id CAA4eK1KnbezhNWHzUrA0cj1Wh5K1ay-wRQr8SYOdrPt9D80ZFw@mail.gmail.com
Whole thread Raw
In response to Re: ERROR: ORDER/GROUP BY expression not found in targetlist  (Amit Kapila <amit.kapila@enterprisedb.com>)
Responses Re: ERROR: ORDER/GROUP BY expression not found in targetlist  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, Jun 17, 2016 at 8:18 AM, Amit Kapila <amit.kapila@enterprisedb.com> wrote:
>
> On Fri, Jun 17, 2016 at 3:20 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> >
>
> > Something like what you have there might work if you use
> > create_projection_path instead of apply_projection_to_path.
> >
>
> Okay, I think you mean to say use create_projection_path() while applying scanjoin_target to partial path lists in below code:
> foreach(lc, current_rel->partial_pathlist)
> {
> Path   *subpath = (Path *) lfirst(lc);
> Assert(subpath->param_info == NULL);
> lfirst(lc) = apply_projection_to_path(root, current_rel,
> subpath, scanjoin_target,
> scanjoin_target_parallel_safe);
> }
>

Attached, please find updated patch based on above lines.  Due to addition of projection path on top of partial paths, some small additional cost is added for parallel paths. In one of the tests in select_parallel.sql the plan was getting converted to serial plan from parallel plan due to this cost, so I have changed it to make it more restrictive.  Before changing, I have debugged the test to confirm that it was due to this new projection path cost.  I have added two new tests as well to cover the new code added by patch.

Note - Apart from the tests related to new code,  Dilip Kumar has helped to verify that TPC-H queries also worked fine (he tested using Explain). He doesn't encounter problem reported above [1] whereas without patch TPCH queries were failing.



With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [sqlsmith] Failed assertion in postgres_fdw/deparse.c:1116
Next
From: "David G. Johnston"
Date:
Subject: Re: 10.0