Re: Inconsistent behavior on Array & Is Null?

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Inconsistent behavior on Array & Is Null?
Date: 2004-04-02 16:53:38
Message-ID: 406D9A92.1020107@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> I think that maybe we ought to question these two properties:
> * empty array is different from NULL ... really? Why?

I think this makes sense, similar to the difference between '' and NULL.

> * storing a value into an element of a NULL array yields
> a NULL array instead of a singleton array.

Same argument. If you think of text as an array or characters, you get
this analogy (sort of):

regression=# create table s1(f1 int, f2 text);
CREATE TABLE
regression=# insert into s1 values(1, null);
INSERT 164679 1

regression=# select f1, substr(f2, 1, 1) is null from s1;
f1 | ?column?
----+----------
1 | t
(1 row)

regression=# update s1 set f2 = 'a' || substr(f2, 2);
UPDATE 1
regression=# select f1, substr(f2, 1, 1) is null from s1;
f1 | ?column?
----+----------
1 | t
(1 row)

Joe

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2004-04-02 16:59:16 Re: Inconsistent behavior on Array & Is Null?
Previous Message Josh Berkus 2004-04-02 16:47:09 Re: PITR for replication?