Re: The semantics of (NULL,NULL) vs NULL

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Ingmar Brouns <swingi(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The semantics of (NULL,NULL) vs NULL
Date: 2012-08-02 17:15:34
Message-ID: CAEYLb_X5eqSL-3vLB4vH3-A8MiqQjmt7okJt-V2CP_Wthv1b7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2 August 2012 17:47, Ingmar Brouns <swingi(at)gmail(dot)com> wrote:
> As I noted that (null,null) is null, I thought why put (null,null) in an
> array when that is the same as putting null in there.
> However, when trying to unnest that array I got an error when using null
> instead of the tuple. I experimented a bit, and
> read the documentation on row and array comparison, but I could not find
> documentation explaining the results below.
>
> create type int_tuple as (a int, b int);
> CREATE TYPE
> =# select (null,null)::int_tuple is null;
> ?column?
> ----------
> t
> (1 row)

Without commenting on the specifics of your test-case, I don't think
any thorough reading of the SQL standard would leave the reader with
the impression that the behaviour of SQL NULL is consistent with some
simple axiom that can be generalised from. I found this blogpost to be
insightful:

http://thoughts.j-davis.com/2009/08/02/what-is-the-deal-with-nulls/

--
Peter Geoghegan http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Grittner 2012-08-02 17:34:07 Re: The semantics of (NULL,NULL) vs NULL
Previous Message Ingmar Brouns 2012-08-02 16:47:22 The semantics of (NULL,NULL) vs NULL