group by error message?

From: Louis-David Mitterrand <vindex+lists-pgsql-general(at)apartia(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: group by error message?
Date: 2008-09-25 14:13:31
Message-ID: 20080925141331.GA27944@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Running this query:

critik=# select distinct pt.type_fr,sum(e2.id_event) from person_type pt natural join person_to_event join event e using (id_event) LEFT JOIN event e2 ON e.id_event = e2.id_event AND e2.id_event=219 join event_type et ON e.id_event_type = et.id_event_type where et.type_fr='théâtre' GROUP BY pt.type_fr IS NULL;

gives this error:

ERROR: column "pt.type_fr" must appear in the GROUP BY clause or be used in an aggregate function

But pt.type_fr is _already_ in the group by.

When adding e2.id_event however ("GROUP BY pt.type_fr,e2.id_event") it works.

Did I miss something there?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Justin Yao 2008-09-25 14:16:46 how can I find out the numeric directory name of each database in PostgreSQL 8.3
Previous Message Marko Kreen 2008-09-25 13:20:30 Re: PostgreSQL future ideas