From: | Andrew D <andrew(dot)do1613(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Postgres Bug - Aggregate with order by |
Date: | 2022-03-31 20:04:03 |
Message-ID: | CAD9rp8B=YkedfmZhn5aRjcmm75s15y78g7jk45FShPvMPbFb3A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hello my name is Andrew,
I believe that I've found a bug within postgres where an aggregate function
is not accepted when an order by clause is specified, here is a short
example:
postgres=# select version();
version
-----------------------------------------------------------------------------------------------------------------------------
PostgreSQL 14.2 (Debian 14.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled
by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
(1 row)
postgres=# create table test_table(i int);
CREATE TABLE
postgres=# insert into test_table values (1);
INSERT 0 1
postgres=# select COUNT(i) from test_table;
count
-------
1
(1 row)
postgres=# select COUNT(i) from test_table order by i;
ERROR: column "test_table.i" must appear in the GROUP BY clause or be used
in an aggregate function
LINE 1: select COUNT(i) from test_table order by i;
^
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-03-31 20:34:02 | Re: Postgres Bug - Aggregate with order by |
Previous Message | David G. Johnston | 2022-03-31 16:06:16 | Re: BUG #17452: IN caluse behaves differently when there is one item comapred to when multiple |