Re: Inconsistent behavior on Array & Is Null? - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Inconsistent behavior on Array & Is Null?
Date
Msg-id 406D9A92.1020107@joeconway.com
Whole thread Raw
In response to Re: Inconsistent behavior on Array & Is Null?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Re: Inconsistent behavior on Array & Is Null?
Next
From: jseymour@LinxNet.com (Jim Seymour)
Date:
Subject: Re: Problems Vacuum'ing