Re: Empty arrays vs. NULLs, 9.1 & 8.3

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Empty arrays vs. NULLs, 9.1 & 8.3
Date: 2012-06-14 23:51:22
Message-ID: 4FDA78FA.5000907@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message xytianer 2012-06-15 00:24:59 pg_ctl start close the cmd.exe then the server would stop.
Previous Message Ken Tanzer 2012-06-14 22:54:30 Re: Empty arrays vs. NULLs, 9.1 & 8.3