Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: "Tom Lane"(at)candle(dot)pha(dot)pa(dot)us, tgl(at)sss(dot)pgh(dot)pa(dot)us, luuk(at)wxs(dot)nl
Cc: The Hermit Hacker <scrappy(at)hub(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison
Date: 1999-10-05 22:16:38
Message-ID: 199910052216.SAA29400@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> >> However, I can't see anything in the SQL92 spec that requires you to
> >> use HAVING intelligently, so maybe this error should be downgraded to
> >> a notice? "HAVING with no aggregates would be faster as a WHERE"
> >> (but we'll do it anyway to satisfy pedants...)
>
> > If we allow them, then people can do things like:
> > HAVING max(a) > b
>
> Er ... what's wrong with that? Assuming b is a group by column,
> of course...

But can we compare aggs and non-aggs? I see now that our code is fine:

select relowner
from pg_class
group by relowner
having max(relowner) = relowner;

This returns the proper result, namely the relowner _having_ the max
id.

Having is using an aggregate and non-aggregate, so when I said we only
support aggregates in the HAVING clause, I was wrong. Looks fine.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-10-05 22:29:45 Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison
Previous Message Tom Lane 1999-10-05 22:05:30 Re: [HACKERS] Re: [GENERAL] Re: [PHP3] Re: PostgreSQL vs Mysql comparison