Received: from fzkmail2.fzk.de (fzkmail2.fzk.de [141.52.27.52]) by postgresql.org (8.11.3/8.11.4) with SMTP id fACF9Rm09321 for ; Mon, 12 Nov 2001 10:09:27 -0500 (EST) (envelope-from ch@rodos.fzk.de) Received: FROM resy5.fzk.de BY fzkmail2.fzk.de ; Mon Nov 12 16:07:28 2001 +0100 Received: by rodos.fzk.de with ESMTP (8.8.6 (PHNE_17135)/8.7.1) id QAA21794; Mon, 12 Nov 2001 16:10:19 +0100 (MET) From: Haller Christoph Message-Id: <200111121505.QAA23169@rodos> Subject: Re: integer attribute 1672 != 1672 To: twanger@bluetwanger.de (Markus Bertheau) Date: Mon, 12 Nov 2001 16:05:34 MET Cc: pgsql-sql@postgresql.org In-Reply-To: <1005576429.31390.4.camel@entwicklung01.cenes.de>; from "Markus Bertheau" at Nov 12, 101 3:54 pm X-Mailer: Elm [revision: 212.4] X-Archive-Number: 200111/157 X-Sequence-Number: 5541 Hi, This is not a bug. I think it's a mistake in understanding aggregate functions and grouping. A typical example for a count/group operation would be Tell me about the number of employees in each department. in SQL select count(employee), department from employee_table group by depatment ; AFAIK if you use an aggregate function on a column and group by this column the result is undefined. Re-think what you want to query. Regards, Christoph > > cenes=> \d partner_views > Table "partner_views" > Attribute | Type | Modifier > ------------+-----------+---------- > partner_id | integer | not null > timestamp | timestamp | not null > Indices: partner_id_partner_views_key, > timestamp_partner_views_key > > cenes=> select count(partner_id), partner_id from partner_views group by > partner_id order by partner_id; > count | partner_id > --------+------------ > 21473 | 0 > 1 | 1672 > 116636 | 0 > 266 | 1670 > 17991 | 1672 > 1 | 0 > 79614 | 1672 > 3723 | 1677 > 39 | 1692 > 30150 | 1814 > 3853 | 1874 > 4951 | 1905 > 2 | 1948 > 28 | 2101 > 241 | 2129 > (15 rows) > > how can this be? is it a known bug which is fixed in 7.1.3? >