Re: Composite type evaluates to Null if any element is null

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Ketema Harris" <ketema(at)ketema(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Composite type evaluates to Null if any element is null
Date: 2008-12-17 16:50:57
Message-ID: b42b73150812170850w3cc2a2far2edf72bd021e5fdc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Dec 17, 2008 at 11:09 AM, Ketema Harris <ketema(at)ketema(dot)net> wrote:
> I have just re-read chapter 8.15 of the 8.3 manual and I am understanding
> why a composite type would evaluate to NUll if any of it elements are null.
>
> Can anyone explain this behavior? To me if I have a composite type column
> and there are some values in it, its incomplete, yes, but not null.

can you be a little more specific?

postgres=# create table ct(a int, b int, c int);
CREATE TABLE
postgres=#
postgres=# select (1, null, 2)::ct;
row
--------
(1,,2)
(1 row)

postgres=# select (1, null, 2)::ct is null;
?column?
----------
f
(1 row)

note, there is significant behavior change in the way composite type
works in comparison purposes for 8.4, which I am using.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonatan Evald Buus 2008-12-17 16:54:12 Prevent new timeline during archive recovery
Previous Message Willy-Bas Loos 2008-12-17 16:44:16 Re: what happens to indexes when TRUNCATEing