pg-mem icon indicating copy to clipboard operation
pg-mem copied to clipboard

Order by an ungrouped column doesn't throw an error when it should

Open rswheeldon opened this issue 10 months ago • 0 comments

Describe the bug

If I sort by a column which isn't in my group by clause, Pg-mem allows it (although doesn't sort correctly) Postgres throws an error, which is what Pg-Mem should do.

To Reproduce

This fails on postgres but wrongly appears to work on pg-mem


postgres=# create table foo (x integer, y integer, z integer);
CREATE TABLE
postgres=# select x, count(distinct y) from foo order by z;
ERROR:  column "foo.x" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select x, count(distinct y) from foo order by z;
               ^
postgres=# 

pg-mem version

2.9.1 (and sandbox at time of writing)

rswheeldon avatar May 20 '25 17:05 rswheeldon