Re: [HACKERS] Gather Merge - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [HACKERS] Gather Merge
Date
Msg-id CA+Tgmoa2F7rcWH4aAPa7W6trUKjZ2nUZCOxEkztRgrZiXhOmUw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Gather Merge  (Rushabh Lathia <rushabh.lathia@gmail.com>)
Responses Re: [HACKERS] Gather Merge  (Rushabh Lathia <rushabh.lathia@gmail.com>)
List pgsql-hackers
On Thu, Mar 9, 2017 at 8:21 AM, Rushabh Lathia <rushabh.lathia@gmail.com> wrote:
> Thanks Robert for committing this.
>
> My colleague Neha Sharma found one regression with the patch. I was about
> to send this mail and noticed that you committed the patch.

Oops.  Bad timing.

> postgres=# explain select aid from pgbench_accounts where aid % 25= 0 group
> by aid;
> ERROR:  ORDER/GROUP BY expression not found in targetlist

I think your fix for this looks right, although I would write it this way:

-    gm_plan->plan.targetlist = subplan->targetlist;
+    gm_plan->plan.targetlist = build_path_tlist(root, &best_path->path);

The second part of your fix looks wrong.  I think you want this:
                        create_gather_merge_path(root,                                                 grouped_rel,
                                           subpath,
 
-                                                 NULL,
+                                                 partial_grouping_target,
  root->group_pathkeys,                                                 NULL,
     &total_groups);
 

That will match the create_gather_path case.

This test case is still failing for me even with those fixes:

rhaas=# select aid+1 from pgbench_accounts group by aid+1;
ERROR:  could not find pathkey item to sort

So evidently there is at least one more bug here.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: [HACKERS] Parallel Bitmap scans a bit broken
Next
From: Pavel Stehule
Date:
Subject: Re: [HACKERS] New CORRESPONDING clause design