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

From Rajkumar Raghuwanshi
Subject ERROR: ORDER/GROUP BY expression not found in targetlist
Date
Msg-id CAKcux6=1_Ye9kx8YLBPmJs_xE72PPc6vNi5q2AOHowMaCWjJ2w@mail.gmail.com
Whole thread Raw
Responses Re: ERROR: ORDER/GROUP BY expression not found in targetlist
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: ToDo: show size of partitioned table
Next
From: Arseny Sher
Date:
Subject: Re: Possible bug in logical replication.