Commit bcc15f15 authored by Bruce Momjian's avatar Bruce Momjian

> David Hartwig wrote:

>
> Please apply this HAVING regression patch.
> > My bad.   It is caused by a known bug having to do with GROUP BY.
It ain't$
> > nothing to do with HAVING.  For some reason the bug went away for a
while, $
> > script.  It must have, because that is how I created the expected
file.   :(
> >
> > A patch to the regression will be forthcoming.
>
parent 58fdae0d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.42 1998/09/01 04:32:54 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.43 1998/09/02 23:37:08 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -610,9 +610,11 @@ byteaGetByte(text *v, int32 n) ...@@ -610,9 +610,11 @@ byteaGetByte(text *v, int32 n)
elog(ERROR, "byteaGetByte: index (=%d) out of range [0..%d]", elog(ERROR, "byteaGetByte: index (=%d) out of range [0..%d]",
n, len - 1); n, len - 1);
} }
#ifdef USE_LOCALE
byte = (unsigned char) (v->vl_dat[n]); byte = (unsigned char) (v->vl_dat[n]);
#else
byte = v->vl_dat[n];
#endif
return (int32) byte; return (int32) byte;
} }
......
...@@ -9,12 +9,12 @@ QUERY: INSERT INTO test_having VALUES (6, 4, 'cccc', 'g'); ...@@ -9,12 +9,12 @@ QUERY: INSERT INTO test_having VALUES (6, 4, 'cccc', 'g');
QUERY: INSERT INTO test_having VALUES (7, 4, 'cccc', 'h'); QUERY: INSERT INTO test_having VALUES (7, 4, 'cccc', 'h');
QUERY: INSERT INTO test_having VALUES (8, 4, 'CCCC', 'I'); QUERY: INSERT INTO test_having VALUES (8, 4, 'CCCC', 'I');
QUERY: INSERT INTO test_having VALUES (9, 4, 'CCCC', 'j'); QUERY: INSERT INTO test_having VALUES (9, 4, 'CCCC', 'j');
QUERY: SELECT max(a) FROM test_having QUERY: SELECT b, c FROM test_having
GROUP BY lower(c) HAVING count(*) > 2 OR min(b) = 3; GROUP BY b, c HAVING count(*) = 1;
max b|c
--- -+--------
5 1|XXXX
9 3|bbbb
(2 rows) (2 rows)
QUERY: SELECT lower(c), count(c) FROM test_having QUERY: SELECT lower(c), count(c) FROM test_having
......
...@@ -15,8 +15,8 @@ INSERT INTO test_having VALUES (7, 4, 'cccc', 'h'); ...@@ -15,8 +15,8 @@ INSERT INTO test_having VALUES (7, 4, 'cccc', 'h');
INSERT INTO test_having VALUES (8, 4, 'CCCC', 'I'); INSERT INTO test_having VALUES (8, 4, 'CCCC', 'I');
INSERT INTO test_having VALUES (9, 4, 'CCCC', 'j'); INSERT INTO test_having VALUES (9, 4, 'CCCC', 'j');
SELECT max(a) FROM test_having SELECT b, c FROM test_having
GROUP BY lower(c) HAVING count(*) > 2 OR min(b) = 3; GROUP BY b, c HAVING count(*) = 1;
SELECT lower(c), count(c) FROM test_having SELECT lower(c), count(c) FROM test_having
GROUP BY lower(c) HAVING count(*) > 2 OR min(a) = max(a); GROUP BY lower(c) HAVING count(*) > 2 OR min(a) = max(a);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment