BUG #14890: Error grouping by same column twice using FDW

Sean Johnston <sean.johnston@edgeintelligence.com>

From: sean.johnston@edgeintelligence.com
To: pgsql-bugs@postgresql.org
Cc: sean.johnston@edgeintelligence.com
Date: 2017-11-07T13:49:48Z
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      14890
Logged by:          Sean Johnston
Email address:      sean.johnston@edgeintelligence.com
PostgreSQL version: 10.0
Operating system:   Linux Ubuntu
Description:        

Using user 'sean' with database 'sean':

create extension postgres_fdw;
create table tbl (col1 integer);
create server loop foreign data wrapper postgres_fdw options ( host
'localhost', dbname 'sean' );
create user mapping for sean server loop options ( user 'sean' );
create foreign table loop_tbl (col1 integer) server loop options (
table_name 'tbl' );

select col1, col1 from loop_tbl group by 1, 2;
psql:t.sql:7: ERROR:  targetlist item has multiple sortgroupref labels



Commits

  1. Fix postgres_fdw to cope with duplicate GROUP BY entries.

  2. postgres_fdw: Push down aggregates to remote servers.