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

From Thomas Munro
Subject ERROR: ORDER/GROUP BY expression not found in targetlist
Date
Msg-id CAEepm=1P94ca18KdQK_uLyAG521mqfF4My5MkFSftCxYuJZYgw@mail.gmail.com
Whole thread Raw
Responses Re: ERROR: ORDER/GROUP BY expression not found in targetlist
Re: ERROR: ORDER/GROUP BY expression not found in targetlist
List pgsql-hackers
Hi,

What is going on here?

postgres=# create table logs as select generate_series(1,
1000000)::text as data;
SELECT 1000000
postgres=# insert into logs select * from logs;
INSERT 0 1000000
postgres=# insert into logs select * from logs;
INSERT 0 2000000
postgres=# insert into logs select * from logs;
INSERT 0 4000000
postgres=# insert into logs select * from logs;
INSERT 0 8000000
postgres=# insert into logs select * from logs;
INSERT 0 16000000
postgres=# analyze logs;
ANALYZE
postgres=# set max_parallel_workers_per_gather = 0;
SET
postgres=# explain select length(data) from logs group by length(data);
┌────────────────────────────────────────────────────────────────────────────┐
│                                 QUERY PLAN                                 │
├────────────────────────────────────────────────────────────────────────────┤
│ Group  (cost=5843157.07..6005642.13 rows=993989 width=4)                   │
│   Group Key: (length(data))                                                │
│   ->  Sort  (cost=5843157.07..5923157.11 rows=32000018 width=4)            │
│         Sort Key: (length(data))                                           │
│         ->  Seq Scan on logs  (cost=0.00..541593.22 rows=32000018 width=4) │
└────────────────────────────────────────────────────────────────────────────┘
(5 rows)

postgres=# set max_parallel_workers_per_gather = 2;
SET
postgres=# explain select length(data) from logs group by length(data);
ERROR:  ORDER/GROUP BY expression not found in targetlist

-- 
Thomas Munro
http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why we don't have checksums on clog files
Next
From: Tatsuro Yamada
Date:
Subject: Re: ERROR: ORDER/GROUP BY expression not found in targetlist