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

So what's an "empty" array anyway?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: So what's an "empty" array anyway?
Date: 2008-10-21 17:50:37
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers
Currently, the constructs
return zero-dimensional arrays, as does the underlying function
construct_empty_array().  I can't immediately find any way at SQL
level to produce an empty array with one or more dimensions.
However, construct_array and construct_md_array will happily build
zero-length arrays of dimension 1 or higher, leading to weirdnesses
such as illustrated here:

Seems like we ought to clean this up.  I'm not sure which way to jump
though: should we decree that arrays of no elements must always have
zero dimensions, or should we get rid of that and standardize on, say,
1-D array with lower bound 1 and upper bound 0?

A somewhat related issue that I noticed while poking at this is that
array_dims() returns NULL for a zero-dimension array.  That seems a bit
bogus too; wouldn't an empty string be saner?  Of course the issue
goes away if we get rid of zero-dimension arrays.


			regards, tom lane


pgsql-hackers by date

Next:From: Martin PihlakDate: 2008-10-21 18:05:48
Subject: Re: Withdraw PL/Proxy from commitfest
Previous:From: Michael MeskesDate: 2008-10-21 17:27:22
Subject: Re: automatic parser generation for ecpg

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