From: Giampiero Raschetti <Giampiero.Raschetti@popso.it>
To: pgsql-sql@postgresql.org
Subject: PgSQL 6.5.1 and Group BY pb
Date: Wed, 25 Aug 1999 13:08:41 +0200
Message-ID: <37C3CEB9.AB63E3DE@popso.it> (raw)
Running PostgreSQL-6.5.1 (rpm version distributed for linux on redhat
6.0)
GROUP BY complitely fails
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 "."
--
Best Regards
----------------------------
Giampiero Raschetti
Sistemi Innovativi
Banca Popolare di Sondrio
----------------------------
Attachments:
smime.p7s (application/x-pkcs7-signature, 1.9K) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Giampiero.Raschetti@popso.it
Subject: Re: PgSQL 6.5.1 and Group BY pb
In-Reply-To: <37C3CEB9.AB63E3DE@popso.it>
References: <37C3CEB9.AB63E3DE@popso.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox