Re: [HACKERS] error on HAVING clause

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: sferac(at)proxy(dot)bazzanese(dot)com (Jose' Soares Da Silva)
Cc: pgsql-bugs(at)postgreSQL(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] error on HAVING clause
Date: 1998-04-10 13:29:59
Message-ID: 199804101329.JAA13073@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> On Thu, 9 Apr 1998, Bruce Momjian wrote:
>
> Don't worry about time Bruce. I'm not in a hurry.
> HAVING is an important feature. Finally SELECT statement is complete.
> I would like to show you another thing about HAVING.

Honestly, I don't know who is right. You are not using an aggregate in
the HAVING, so I have no idea how it is supposed to be handled.

>
> prova=> select sno,qty from sp group by sno,qty having qty = 300;
> sno |qty
> -----+---
> S1 |100
> S1 |200
> S1 |300
> S1 |400
> S2 |300
> S2 |400
> S3 |200
> S4 |200
> S4 |300
> S4 |400
> (10 rows)
>
> prova=> select oid,sno,qty from sp group by sno,qty having qty = 300;
> oid|sno |qty
> ------+-----+---
> 147004|S1 |100
> 147001|S1 |200
> 147000|S1 |300
> 147002|S1 |400
> 147006|S2 |300
> 147007|S2 |400
> 147008|S3 |200
> 147009|S4 |200
> 147010|S4 |300
> 147011|S4 |400
> (10 rows)
>
> Solid give me another result. Who are rigth ?
>
> SOLID SQL Editor (teletype) v.02.20.0007
> select sno,qty from sp group by sno,qty having qty = 300;
> SNO QTY
> --- ---
> S1 300.
> S2 300.
> S4 300.
> 3 rows fetched.
>
> Maybe this one is illegal, but it give me a strange output:
>
> prova=> select oid,sno,qty from sp having qty = 300;
> | | <---------where is the title ????
> ------+-----+---
> 147000|S1 |300
> 147001|S1 |200
> 147002|S1 |400
> 147003|S1 |200
> 147004|S1 |100
> 147005|S1 |100
> 147006|S2 |300
> 147007|S2 |400
> 147008|S3 |200
> 147009|S4 |200
> 147010|S4 |300
> 147011|S4 |400
> (12 rows)
> Jose'
>
>

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-04-10 13:33:04 Re: [HACKERS] error on HAVING clause
Previous Message Peter T Mount 1998-04-10 10:48:17 Re: [HACKERS] v6.3.2 ...