GROUP BY bug report

From: Giampiero Raschetti <Giampiero(dot)Raschetti(at)popso(dot)it>
To: pgsql-bugs(at)postgresql(dot)org
Subject: GROUP BY bug report
Date: 1999-08-12 15:44:54
Message-ID: 37B2EBF6.A68BB398@popso.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Giampiero Raschetti
Your email address : giampiero(dot)raschetti(at)popso(dot)it

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.5-15 ELF
(REDHAT 6.0)

PostgreSQL version (example: PostgreSQL-6.5.1): PostgreSQL-6.5.1
(RPM version)

Compiler used (example: gcc 2.8.0) : gcc

Please enter a FULL description of your problem:
------------------------------------------------

GROUP BY fails to work, and SELECT DISTINCT too.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

bash$ psql template1
template1=> CREATE TABLE "gruppi" ("id" int4 NOT NULL,"nome" character
varying(32));
CREATE
template1=> CREATE TABLE "usergroup" ("id" int4 NOT NULL,"uid" int4 NOT
NULL,"gid" int4 NOT NULL);
CREATE
template1=> insert into gruppi values (0,'ciao');
INSERT 31637 1
template1=> insert into gruppi values (1,'pippo');
INSERT 31638 1
template1=> insert into usergroup values (0,1,2);
INSERT 31639 1
template1=> insert into usergroup values (0,2,3);
INSERT 31640 1
template1=> insert into usergroup values (1,2,3);
INSERT 31641 1

And now the output query with GROUP BY:

template1=> SELECT g.nome,u.uid,u.id FROM gruppi g, usergroup u GROUP BY
g.nome;
ERROR: Illegal use of aggregates or non-group column in target list
template1=> SELECT nome,id FROM gruppi GROUP BY nome;
ERROR: Illegal use of aggregates or non-group column in target list

And now the output query with SELECT DISTINCT:

template1=> SELECT DISTINCT ON g.nome g.nome,u.uid,u.id from gruppi g,
usergroup u;
ERROR: parser: parse error at or near "."

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

NO ANS.

Browse pgsql-bugs by date

  From Date Subject
Next Message Victor Vislobokov 1999-08-12 17:30:11 bug
Previous Message Sezai Yilmaz 1999-08-11 22:20:40 table list problem.