Re: [BUGS] BUG #14890: Error grouping by same column twice using FDW - Mailing list pgsql-bugs

From Jeevan Chalke
Subject Re: [BUGS] BUG #14890: Error grouping by same column twice using FDW
Date
Msg-id CAM2+6=W5Kcx+YYhXiVTQr+X6zzW12i705A1dSzeu8gRzKG=Yug@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] BUG #14890: Error grouping by same column twice using FDW  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
List pgsql-bugs


On Fri, Nov 10, 2017 at 6:14 PM, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote:

+            /*
+             * Pushable, add to tlist. We need to create a tle for this
+             * expression and need to transfer the sortgroupref too. We cannot
+             * use add_to_flat_tlist() here as it avoids the duplicate entries
+             * in the targetlist but here we want those duplicate entries as
+             * there can be multiple GROUP BY expressions pointing to the same
+             * column at different positions.
+             */
+            tle = makeTargetEntry((Expr *) expr, list_length(tlist) + 1, NULL,
+                                  false);
+            tle->ressortgroupref = sgref;
+            tlist = lappend(tlist, tle);

May be we want to use add_flat_to_tlist() when sgref is not present to avoid
duplicate entries.


These code changes are already inside sgref check. And for other places we do use add_to_flat_tlist().



--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company



--
Jeevan Chalke
Technical Architect, Product Development
EnterpriseDB Corporation
The Enterprise PostgreSQL Company

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [BUGS] BUG #14866: The generated constraint in the typed tablecauses the server to crash
Next
From: Jeevan Chalke
Date:
Subject: Re: [BUGS] BUG #14890: Error grouping by same column twice using FDW