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

From: Michael Fuhr <mike(at)fuhr(dot)org>
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
Date: 2005-03-10 19:24:41
Message-ID: 20050310192441.GA86977@winnie.fuhr.org
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

Not that this means much, but I'll mention it for the sake of
completeness: SQLite 3.0.8 disallows all of the above SELECT
statements:

sqlite> create table tab (col integer);
sqlite> select 1 from tab having 1=0;
SQL error: a GROUP BY clause is required before HAVING
sqlite> select 1 from tab having 1=1;
SQL error: a GROUP BY clause is required before HAVING
sqlite> insert into tab values(1);
sqlite> insert into tab values(2);
sqlite> select 1 from tab having 1=0;
SQL error: a GROUP BY clause is required before HAVING
sqlite> select 1 from tab having 1=1;
SQL error: a GROUP BY clause is required before HAVING

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message johnnnnnn 2005-03-10 20:01:28 Re: [HACKERS] We are not following the spec for HAVING without GROUP BY
Previous Message Gary Doades 2005-03-10 19:12:48 Re: [HACKERS] We are not following the spec for HAVING without

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrian Nida 2005-03-10 19:36:52 PostgreSQL pam ldap document
Previous Message Nicolai Tufar 2005-03-10 19:22:13 Re: [pgsql-hackers-win32] snprintf causes regression tests to fail