Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] No: implied sort with group by

From: Andrew Martin <martin(at)biochemistry(dot)ucl(dot)ac(dot)uk>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] No: implied sort with group by
Date: 1998-01-29 10:43:34
Message-ID: 199801291043.KAA15245@bsmir06.biochem.ucl.ac.uk (view raw or flat)
Thread:
Lists: pgsql-hackers
> > > postgres=> select b,c,sum(a) from t1 group by b,c;
> > > b|c|sum
> > > -+-+---
> > >  |x|  5
> > >  |z|  3
> > >  |x|  0
> > > (3 rows)
> > >
> > > postgres=> select * from t1;
> > > a|b|c
> > > -+-+-
> > > 1| |x
> > > 2| |x
> > > 2| |x
> > > 3| |z
> > > 0| |x
> > > (5 rows)
> > >
> > > I just inserted a single out-of-order row at the end of the table which, since the
> > > integer value is zero, should have not affected the result. Sorry I didn't understand
> > > the nature of the test case.
> 
> > Hmmm...is this a grouping problem or an aggregate problem?  Or both?  The first
> > query above should have the data sorted before aggregating, shouldn't it, or I
> > am still missing a piece of this puzzle?
> 
> fwiw, I see the same incorrect behavior in v6.2.1p5.
> 
>                                                 - Tom
> 
> 
And in v6.1. If b is a space (rather than a NULL), then the behaviour is correct
so it must be a problem in grouping NULLs.


Andrew


----------------------------------------------------------------------------
Dr. Andrew C.R. Martin                             University College London
EMAIL: (Work) martin(at)biochem(dot)ucl(dot)ac(dot)uk    (Home) andrew(at)stagleys(dot)demon(dot)co(dot)uk
URL:   http://www.biochem.ucl.ac.uk/~martin
Tel:   (Work) +44(0)171 419 3890                    (Home) +44(0)1372 275775

pgsql-hackers by date

Next:From: Andrew MartinDate: 1998-01-29 10:49:50
Subject: Re: [HACKERS] postmaster crash and .s.pgsql file
Previous:From: Zeugswetter Andreas DBTDate: 1998-01-29 10:23:15
Subject: Re: [HACKERS] No: implied sort with group by

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group