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

From Josh Berkus
Subject Inconsistent behavior on Array & Is Null?
Date
Msg-id 200403301134.15409.josh@agliodbs.com
Whole thread Raw
Responses Re: Inconsistent behavior on Array & Is Null?  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Joe,

First off, pardon me if these are known things which are already fixed in CVS.  
Also, let me again thank you for all the work on Arrays in 7.4; I've been 
able to tremendously simplify quite a number of procedures in my databases 
thanks to the new array support.

Now, the issue:
I'm noticing some inconsistent behavior regarding empty arrays and IS NULL 
status.    For example:

net_test=# select array_upper('{}'::INT[], 1);array_upper
-------------

(1 row)

net_test=# select array_upper('{}'::INT[], 1) IS NULL;?column?
----------t
(1 row)

net_test=# select '{}'::INT[] IS NULL;?column?
----------f
(1 row)

I feel that this is confusing; an empty array should be considered NULL 
everywhere or nowhere.     For that matter, the new array declaration syntax 
does not support empty arrays:

net_test=# select ARRAY[ ]::INT[];
ERROR:  syntax error at or near "]" at character 15
net_test=# select ARRAY[]::INT[];
ERROR:  syntax error at or near "]" at character 14
net_test=#

-- 
-Josh BerkusAglio Database SolutionsSan Francisco



pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: cvs HEAD regression
Next
From: Alvaro Herrera
Date:
Subject: Re: Transaction question