Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > Proposal: new f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 17 Topic 9474 of 10966
Post > Topic >>

Proposal: new function array_init

by pavel.stehule@[EMAIL PROTECTED] ("Pavel Stehule") Jun 2, 2008 at 06:03 PM

Hello

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);
     array
---------------
     {0,0}
(1 row)


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

Any comments?

Regards
Pavel Stehule

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 17 Posts in Topic:
Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-02 18:03:06 
Re: Proposal: new function array_init
tgl@[EMAIL PROTECTED] (T  2008-06-02 12:46:44 
Re: Proposal: new function array_init
webb.sprague@[EMAIL PROTE  2008-06-02 10:18:08 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-02 20:10:19 
Re: Proposal: new function array_init
pgsql@[EMAIL PROTECTED]   2008-06-02 11:56:28 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-04 14:57:38 
Re: Proposal: new function array_init
tgl@[EMAIL PROTECTED] (T  2008-06-04 10:56:44 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-04 22:22:11 
Re: Proposal: new function array_init
tgl@[EMAIL PROTECTED] (T  2008-06-04 16:29:43 
Re: Proposal: new function array_init
andrew@[EMAIL PROTECTED]   2008-06-04 16:36:35 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-04 22:34:01 
Re: Proposal: new function array_init
tgl@[EMAIL PROTECTED] (T  2008-06-04 16:37:18 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-04 23:23:08 
Re: Proposal: new function array_init
tgl@[EMAIL PROTECTED] (T  2008-06-04 17:34:48 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-04 23:41:07 
Re: Proposal: new function array_init
tgl@[EMAIL PROTECTED] (T  2008-06-04 18:38:57 
Re: Proposal: new function array_init
pavel.stehule@[EMAIL PROT  2008-06-05 05:59:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 14:20:48 CST 2008.