Re: [SQL] What's wrong with this group by clause? - Mailing list pgsql-hackers

From Manfred Koizar
Subject Re: [SQL] What's wrong with this group by clause?
Date
Msg-id qn717v872enmaa16qmj147p7kmotodn6uv@4ax.com
Whole thread Raw
Responses Re: [SQL] What's wrong with this group by clause?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
[forwarding to -hackers]

On Tue, 4 Nov 2003 18:28:12 -0300, Franco Bruno Borghesi
<franco@akyasociados.com.ar> wrote:
>Below you can find a simplified example of a real case. 
>I don't understand why I'm getting the "john" record twice. 

ISTM you have found a Postgres 7.3 bug.

I get one john withPostgreSQL 7.1.3 on i686-pc-cygwin, compiled by GCC 2.95.3-5
andPostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.7.2.1

but two johns withPostgreSQL 7.3.2 on i686-pc-linux-gnu, compiled by GCC 2.7.2.1

>/*EXAMPLE*/
>CREATE TABLE people
>(
>   name TEXT
>);
>INSERT INTO people VALUES ('john');
>INSERT INTO people VALUES ('john');
>INSERT INTO people VALUES ('pete');
>INSERT INTO people VALUES ('pete');
>INSERT INTO people VALUES ('ernest');
>INSERT INTO people VALUES ('john');
>   
>SELECT
>   0 AS field1,
>   0 AS field2, 
>   name
>FROM
>   people
>GROUP BY
>   field1,
>   field2,
>   name;
>
> field1 | field2 |  name
>--------+--------+--------
>      0 |      0 | john
>      0 |      0 | pete
>      0 |      0 | ernest
>      0 |      0 | john
>(4 rows)

Same forSELECT 0 AS field1, 0 AS field2, name  FROM people GROUP BY 1, 2, name;

ServusManfred


pgsql-hackers by date:

Previous
From: "Hiroshi Inoue"
Date:
Subject: Re: Roadmap for FE/BE protocol redesign
Next
From: Tom Lane
Date:
Subject: Re: Roadmap for FE/BE protocol redesign