Re: [HACKERS] We are not following the spec for HAVING without GROUP

From: Kevin HaleBoyes <khaleboyes(at)chartwelltechnology(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [HACKERS] We are not following the spec for HAVING without GROUP
Date: 2005-03-10 18:21:14
Message-ID: 4230901A.3080101@chartwelltechnology.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tom Lane wrote:
> Would those of you with access to other DBMSes try this:
>
> create table tab (col integer);
> select 1 from tab having 1=0;
> select 1 from tab having 1=1;
> insert into tab values(1);
> insert into tab values(2);
> select 1 from tab having 1=0;
> select 1 from tab having 1=1;
>
> I claim that a SQL-conformant database will return 0, 1, 0, and 1 rows
> from the 4 selects --- that is, the contents of tab make no difference
> at all. (MySQL returns 0, 0, 0, and 2 rows, so they are definitely
> copying our mistake...)
>
> regards, tom lane

From SQL server 2000 with a service pack, I get:

zero rows from the first query (having 1=0);
one row, col value 1, from second query (having 1=1);
...run inserts...
zero rows from the third query (having 1=0);
one row, col value 1, from forth query (having 1=1);

K.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Barry Lind 2005-03-10 18:34:08 Re: [HACKERS] We are not following the spec for HAVING without GROUP BY
Previous Message Gill, Jerry T. 2005-03-10 18:13:31 Re: [HACKERS] We are not following the spec for HAVING without GROUP BY

Browse pgsql-hackers by date

  From Date Subject
Next Message Barry Lind 2005-03-10 18:34:08 Re: [HACKERS] We are not following the spec for HAVING without GROUP BY
Previous Message Bort, Paul 2005-03-10 18:15:47 Re: Raw size