Re: [HACKERS] 6.4 Aggregate Bug - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] 6.4 Aggregate Bug
Date
Msg-id 35C327DC.9F87D7C6@alumni.caltech.edu
Whole thread Raw
In response to 6.4 Aggregate Bug  (David Hartwig <daybee@bellatlantic.net>)
Responses Re: [HACKERS] 6.4 Aggregate Bug  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
> While testing  my 6.4 patch to allow functions/expressions to be
> specified in the ORDER/GROUP BY clause (and not in the target list) I
> came across a nasty little bug.
> I backed out my patch, and discovered  the bug was still present. The
> bug does not exist in version 6.3.2.

Nor in my cvs tree from around the second week in July (on or before
July 9, with a few patches committed to the Postgres tree afterwards).
Haven't tried a current source tree...

                         - Tom

>
> -- This crashes the backend
>     select upper(a) as x, count(k) from t group by x;

tgl=> create table t (a text, k int);
CREATE
tgl=> select upper(a) as x, count(k) from t group by x;
x|count
-+-----
 |    0
(1 row)

tgl=> insert into t values ('one', 1);
INSERT 643434 1
tgl=> insert into t values ('two', 2);
INSERT 643435 1
tgl=> insert into t values ('two', 2);
INSERT 643436 1
tgl=> select upper(a) as x, count(k) from t group by x;
x  |count
---+-----
ONE|    1
TWO|    2
(2 rows)

And with your test case instead:

tgl=> select upper(a) as x, count(k) from t group by x;
x|count
-+-----
A|    4
B|    3
C|    3
(3 rows)

pgsql-hackers by date:

Previous
From: Edmund Mergl
Date:
Subject: Re: [HACKERS] 6.4 Aggregate Bug
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] OR with multi-key indexes