Hi,

Below test case is failing with ERROR:  ORDER/GROUP BY expression not found
in targetlist. this issue is reproducible from PGv10.

postgres=# CREATE TABLE test(c1 int, c2 text, c3 text);
CREATE TABLE
postgres=# INSERT INTO test SELECT i % 10, i % 250, to_char(i % 4,
'FM0000000') FROM GENERATE_SERIES(1,100000,1)i;
INSERT 0 100000
postgres=# ANALYZE test;
ANALYZE
postgres=# EXPLAIN (verbose) SELECT c1, generate_series(1,1), count(*) FROM
test GROUP BY 1 HAVING count(*) > 1;
                                  QUERY
PLAN
-------------------------------------------------------------------------------
 ProjectSet  (cost=2291.00..2306.15 rows=3000 width=16)
   Output: c1, generate_series(1, 1), (count(*))
   ->  HashAggregate  (cost=2291.00..2291.12 rows=3 width=12)
         Output: c1, count(*)
         Group Key: test.c1
         Filter: (count(*) > 1)
         ->  Seq Scan on public.test  (cost=0.00..1541.00 rows=100000
width=4)
               Output: c1, c2, c3
(8 rows)

postgres=# SET min_parallel_table_scan_size=0;
SET
postgres=# EXPLAIN (verbose) SELECT c1, generate_series(1,1), count(*) FROM
test GROUP BY 1 HAVING count(*) > 1;
ERROR:  ORDER/GROUP BY expression not found in targetlist

Thanks & Regards,
Rajkumar Raghuwanshi
QMG, EnterpriseDB Corporation

Reply via email to