Re: Empty arrays vs. NULLs, 9.1 & 8.3 - Mailing list pgsql-general

From Steve Crawford
Subject Re: Empty arrays vs. NULLs, 9.1 & 8.3
Date
Msg-id 4FDA78FA.5000907@pinpointresearch.com
Whole thread Raw
In response to Re: Empty arrays vs. NULLs, 9.1 & 8.3  (Ken Tanzer <ken.tanzer@gmail.com>)
List pgsql-general
On 06/14/2012 03:54 PM, Ken Tanzer wrote:
> Thanks Steve.  FWIW I looked at the 9.0 and 9.1 release notes, and
> didn't find much on arrays in them.
The notes are terse (a 1-2 line comment encapsulates the results of
hundreds of messages covering a couple year) but there are many
references to updates in how arrays are handled.
>
> I do have one follow-up curiosity question, though.  Why does
> array_dims(array[]::varchar[]) return NULL instead of 0?  I would
> expect NULL for a NULL array, but not an empty one.  (And the same for
> array_[upper,lower,length] functions as well.
I can't answer, specifically. But it makes a certain amount of sense. An
empty array has no elements so where does it "begin" or "end" -
especially since PostgreSQL array indexes don't need to start at 1 and
the array could be multi-dimensional. Unknown, aka null, seems the best
response.

Cheers,
Steve


pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Empty arrays vs. NULLs, 9.1 & 8.3
Next
From: xytianer
Date:
Subject: pg_ctl start close the cmd.exe then the server would stop.