Re: So what's an "empty" array anyway?

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Andrew Chernow <ac(at)esilo(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: So what's an "empty" array anyway?
Date: 2008-10-21 20:52:58
Message-ID: D88BBA3D-5FF0-4AE6-A6A5-236E72935A3B@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Oct 21, 2008, at 13:00, Andrew Chernow wrote:

>> On Oct 21, 2008, at 12:08, Simon Riggs wrote:
>> If we got rid of zero dimension arrays, how would I declare a new
>> empty array in a PL/pgSQL function?
>
> Why would you want to do that? Is there a use case for that?

Perhaps not. In older versions of PostgreSQL, I *had* to initialize an
empty array in a DECLARE block or else I couldn't use it with
array_append() to collect things in an array in a loop. I don't have
to do so 8.3, but I keep it that way in some modules for compatibility
reasons.

But since that was perhaps an issue with older versions of PostgreSQL
that has since been addressed, I guess I just think too much like a
Perl hacker, where I can add things to an array as I need to. That's
different from SQL arrays, where you can't add a value to an existing
array, create a new array from an old one plus a new value.

So I guess I don't *have* to have it, but for compatibility with older
versions of PostgreSQL, I think they should be kept.

Best,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-10-21 20:58:41 Re: So what's an "empty" array anyway?
Previous Message Julius Stroffek 2008-10-21 20:49:36 Re: Multi CPU Queries - Feedback and/or suggestions wanted!