ERROR: ORDER/GROUP BY expression not found in targetlist

From: Rajkumar Raghuwanshi <rajkumar(dot)raghuwanshi(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: ERROR: ORDER/GROUP BY expression not found in targetlist
Date: 2018-06-20 07:52:26
Message-ID: CAKcux6=1_Ye9kx8YLBPmJs_xE72PPc6vNi5q2AOHowMaCWjJ2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Arseny Sher 2018-06-20 07:59:28 Re: Possible bug in logical replication.
Previous Message Pavel Stehule 2018-06-20 07:50:11 Re: ToDo: show size of partitioned table