Re: AW: Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Stand ards - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AW: Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Stand ards
Date
Msg-id 8339.992895969@sss.pgh.pa.us
Whole thread Raw
In response to Re: AW: Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Stand ards  ("Joe Conway" <joseph.conway@home.com>)
List pgsql-hackers
"Joe Conway" <joseph.conway@home.com> writes:
> I also noticed that in PostgreSQL I can do the following (both before and
> after this patch):
>     select f2 is null from foo;
> whereas in both Oracle and MSSQL it causes a syntax error. Any thoughts on
> this?

I dug into this further and discovered that indeed it is not SQL92
... but it is SQL99.  Amazingly enough, SQL92 doesn't allow boolean
expressions as a possible type of general expression:
        <value expression> ::=               <numeric value expression>             | <string value expression>
   | <datetime value expression>             | <interval value expression>
 

It only allows them as <search condition>s, which is to say WHERE,
HAVING, CASE WHEN, CHECK, and one or two other places.

But SQL99 gets it right:
        <value expression> ::=               <numeric value expression>             | <string value expression>
   | <datetime value expression>             | <interval value expression>             | <boolean value expression>
       | <user-defined type value expression>             | <row value expression>             | <reference value
expression>            | <collection value expression>
 

Looks like we're ahead of the curve here...
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Joe Conway"
Date:
Subject: Re: AW: Re: [SQL] behavior of ' = NULL' vs. MySQL vs. Stand ards
Next
From: The Hermit Hacker
Date:
Subject: Re: [SQL] LEFT JOIN ...