Skip site navigation (1) Skip section navigation (2)

Re: array_length of an empty array

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: array_length of an empty array
Date: 2012-07-29 15:10:01
Message-ID: 21633.1343574601@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
John R Pierce <pierce(at)hogranch(dot)com> writes:
> hmmm.    array[]::integer[]    is an empty array, {}, eg an array with 
> zero elements

> but array_length(array[]::integer[])   is NULL rather than zero.    this 
> seems counterintuitive.

IIRC, there are a whole bunch of questionable behaviors around empty
arrays.  Somebody should go through the whole list of array-related
functions and come up with a coherent proposal for fixing all of them.

			regards, tom lane

In response to

pgsql-general by date

Next:From: Guillermo Echevarria Quintana-GurtDate: 2012-07-29 18:30:23
Subject: password help
Previous:From: Ryan KellyDate: 2012-07-29 13:55:57
Subject: Re: array_length of an empty array

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group