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

Proposal: new function array_init

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Proposal: new function array_init
Date: 2008-06-02 16:03:06
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

There was more time questions about array's initialisation. I propose
function array_init.

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

First parameter is array of dimension's sizes. Second argument is
value that will be used for initialisation.

Because pg array's indexes must not start from 1 we can allow specify it.

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

select array_init(array[2],0);
(1 row)

select array_init(array[1,2], 0);
(1 row)

Any comments?

Pavel Stehule


pgsql-hackers by date

Next:From: David E. WheelerDate: 2008-06-02 16:13:55
Subject: Re: Case-Insensitve Text Comparison
Previous:From: Jignesh K. ShahDate: 2008-06-02 15:59:21
Subject: Re: Overhauling GUCS

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