Re: comparing NEW and OLD (any good this way?)

From: Willy-Bas Loos <willybas(at)gmail(dot)com>
To: Sam Mason <sam(at)samason(dot)me(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: comparing NEW and OLD (any good this way?)
Date: 2009-08-12 08:51:04
Message-ID: 1dd6057e0908120151j62a65276we220cfb7ad7b73c0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> SELECT r IS NULL, r IS NOT NULL
> FROM (VALUES (1,NULL)) r(a,b);
>
> returns FALSE for *both* columns. How can a row be both NULL *and*
> non-NULL?

Actually, the value is neither NULL, nor non-NULL.
Part of it is NULL and part of it isn't so neither "IS NULL" is true,
nor is "IS NOT NULL"

cheers,
WBL

On Wed, Jul 29, 2009 at 3:40 PM, Sam Mason<sam(at)samason(dot)me(dot)uk> wrote:
> On Wed, Jul 29, 2009 at 01:15:27PM +0000, Jasen Betts wrote:
>> On 2009-07-23, Sam Mason <sam(at)samason(dot)me(dot)uk> wrote:
>> >   http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks#Attention_on_IS_NULL_and_IS_NOT_NULL_operators_for_composite_types
>> >
>> > is scary; even worse is that it was changed to be like this in 8.2
>> > because the standard says it should behave this way.  What on earth were
>> > they thinking when they defined the standard this way?
>>
>> since any comparson involving those tuples will return NULL true is the
>> correct value for IS NULL
>
> I think you missed the point:
>
>  SELECT r IS NULL, r IS NOT NULL
>  FROM (VALUES (1,NULL)) r(a,b);
>
> returns FALSE for *both* columns.  How can a row be both NULL *and*
> non-NULL?
>
>> if you are bothered by this behavior you are misusing NULL.
>
> I understand that this is the specified behavior, and hence PG is
> correctly following the spec--but it still bothers me.
>
> --
>  Sam  http://samason.me.uk/
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
"Patriotism is the conviction that your country is superior to all
others because you were born in it." -- George Bernard Shaw

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alan Millington 2009-08-12 09:59:37 plpython.dll dependencies
Previous Message Richard Huxton 2009-08-12 08:18:24 Re: ERROR: XLogFlush: request AF/5703EDC8 is not satisfied --- flushed only to AF/50F15ABC