pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manfred Koizar <mkoi-pg@aon.at>
To: Franco Bruno Borghesi <franco@akyasociados.com.ar>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-hackers@postgresql.org
Subject: Re: [SQL] What's wrong with this group by clause?
Date: Thu, 13 Mar 2003 16:16:29 +0100
Message-ID: <qn717v872enmaa16qmj147p7kmotodn6uv@4ax.com> (raw)
In-Reply-To: <200311041828.13144.franco@akyasociados.com.ar>
References: <200311041828.13144.franco@akyasociados.com.ar>

[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 with
 PostgreSQL 7.1.3 on i686-pc-cygwin, compiled by GCC 2.95.3-5
and
 PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.7.2.1

but two johns with
 PostgreSQL 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 for
	SELECT 0 AS field1, 0 AS field2, name
	  FROM people
	 GROUP BY 1, 2, name;

Servus
 Manfred



view thread (8+ messages)  latest in thread

Message-ID: <qn717v872enmaa16qmj147p7kmotodn6uv@4ax.com>
Permalink:  ../qn717v872enmaa16qmj147p7kmotodn6uv@4ax.com/
Also on:    postgresql.org/message-id/qn717v872enmaa16qmj147p7kmotodn6uv@4ax.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mkoi-pg@aon.at, franco@akyasociados.com.ar, pgsql-hackers@postgresql.org
  Subject: Re: [SQL] What's wrong with this group by clause?
  In-Reply-To: <qn717v872enmaa16qmj147p7kmotodn6uv@4ax.com>

* 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