From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: john@august.com, Josh Berkus <josh@agliodbs.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: not null - trivial, unexpected behavior
Date: Sat, 16 Jun 2001 21:23:36 -0400
Message-ID: <28530.992741016@sss.pgh.pa.us> (raw)
In-Reply-To: <Pine.LNX.4.30.0106170212520.6413-100000@peter.localdomain>
References: <Pine.LNX.4.30.0106170212520.6413-100000@peter.localdomain>
Peter Eisentraut <peter_e@gmx.net> writes:
> John Scott writes:
>> but, as i understand the sql92 standard, both att = null and att != null
>> are NOT sql92.
> They are. We just don't implement att = null right because of reasons
> that can be found in the archives.
In a very narrow sense, they're not SQL92, because SQL92 doesn't
actually allow an unadorned keyword NULL to appear in arbitrary
expression contexts. You could legally write the expression as
att = CAST (NULL AS type-of-att)
and then the required result would always be NULL, a/k/a UNKNOWN
(nb. this is NOT the same as FALSE). And indeed that's what Postgres
will produce if you do it that way.
In practice, since Postgres extends the spec to allow the unadorned
keyword NULL to appear in arbitrary expressions (with implicit
resolution of the datatype of the null), you'd expect that
att = NULL
would behave the same as if the NULL came from a CAST, evaluation of
a data value, etc. But it doesn't, for reasons that have been
discussed already.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, peter_e@gmx.net, josh@agliodbs.com
Subject: Re: not null - trivial, unexpected behavior
In-Reply-To: <28530.992741016@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox