Re: When is a record NULL?

From: Richard Huxton <dev(at)archonet(dot)com>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Brendan Jurd <direvus(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: When is a record NULL?
Date: 2009-07-24 10:16:56
Message-ID: 4A698A18.6090300@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

David E. Wheeler wrote:
> On Jul 23, 2009, at 9:34 PM, Brendan Jurd wrote:

>> I guess the spec authors figured they might as well make IS [NOT] NULL
>> do something useful when applied to a row rather than throwing an
>> error. I tend to agree.
>
> Frankly, I find the state where a record with a NULL and a not-null
> value being neither NULL nor not NULL bizarre.

I'm guessing the justification (and presumably this was worked out based
on the behaviour of one or more of the big DB providers and then
justified afterwards) is that the composite is "partially unknown". Of
course you should either introduce a new code or throw an error, but
four-valued logic isn't going to win you any friends.

If the argument *is* that because you know part of the overall value the
composite isn't null then I'd argue that ('abc' || null) isn't null
either. After all, the first three characters are perfectly well
established.

>> I hope that provides some clarity.
>
> It's useful to learn that `ROW(NULL, NULL)` is NULL, but I find the
> whole thing totally bizarre. Is it me?

Yes, just you. None of the rest of us have any problems with this at all :-)

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2009-07-24 10:17:16 Re: When is a record NULL?
Previous Message David E. Wheeler 2009-07-24 09:15:56 Re: When is a record NULL?