Re: Proposal: new function array_init - Mailing list pgsql-hackers

From Webb Sprague
Subject Re: Proposal: new function array_init
Date
Msg-id b11ea23c0806021018v5be4edb8v3a8294af766d5d0@mail.gmail.com
Whole thread Raw
In response to Re: Proposal: new function array_init  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Jun 2, 2008 at 9:46 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Pavel Stehule" <pavel.stehule@gmail.com> writes:
>> There was more time questions about array's initialisation. I propose
>> function array_init.

As one of the questioners, I will give some short thoughts below.

>> CREATE OR REPLACE FUNCTION array_init(sizes int[], v anyelement)
>> RETURNS anyarray;

+1.  +0 for Pavel's proposed syntax, because it feels better, but also
it scales to N dimensions (we should throw an error obviously if the
input is too big, but we can probably source that size through an
include), I hate functions with more than four arguments, and having
six slightly overloaded functions in the system catalogs seems
annoying.

> * We can handle a null fill value now, but what about nulls in the
> dimensions?  The alternatives seem to be to return a null array
> (not an array of nulls) or throw error.

I would throw an error, unless there is something that one can do with
a null array (perhaps there is?).

We also might want to consider a resize function, and some other
utilities as long as we are bothering with this.

I am sorry that I can't offer to write these, but I don't have the
time to learn the Postgresql infrastructure to do it.

Thanks for the attention Pavel!


pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: Overhauling GUCS
Next
From: Jeff Davis
Date:
Subject: Re: Case-Insensitve Text Comparison