Re: [GENERAL] Populating a sparse array piecemeal in plpgsql (REDUX)

2008-05-28 Thread Pavel Stehule
2008/5/27 Webb Sprague <[EMAIL PROTECTED]>: > I am trying to return a 2-d array with filled in values, but I can't > find a way to initialize the array programmatically (ie, in a > function, with the array size being determined by parameter values. > > here is one approach > >> Well, the point is t

Re: [GENERAL] Populating a sparse array piecemeal in plpgsql

2008-05-15 Thread Eliot, Christopher
Thanks, that worked. I actually initialized it to zeros (so that my incrementing would work). Thanks for the example. I wouldn't have figured out to put quote marks around the initialization value otherwise. Topher Eliot [EMAIL PROTECTED] [] -- Sent via pgsql-general mailing list (pgsql-gener

Re: [GENERAL] Populating a sparse array piecemeal in plpgsql

2008-05-15 Thread Tom Lane
"Eliot, Christopher" <[EMAIL PROTECTED]> writes: > Thank you for your reply, but I don't really understand how to use this > information. > My problem is that I can put one value into this array, and that's it. > Any subsequent attempts to put another value elsewhere in the array are > rebuffed, sa

Re: [GENERAL] Populating a sparse array piecemeal in plpgsql

2008-05-15 Thread Eliot, Christopher
rg > Subject: Re: [GENERAL] Populating a sparse array piecemeal in plpgsql > > "Eliot, Christopher" <[EMAIL PROTECTED]> writes: > > CREATE FUNCTION func1() > > RETURNS VOID AS $$ > > DECLARE > > a INTEGER[2][2][2][200]; > > BEGIN > >

Re: [GENERAL] Populating a sparse array piecemeal in plpgsql

2008-05-15 Thread Tom Lane
"Eliot, Christopher" <[EMAIL PROTECTED]> writes: > CREATE FUNCTION func1() > RETURNS VOID AS $$ > DECLARE > a INTEGER[2][2][2][200]; > BEGIN > a[1][2][1][33] = 0; > a[2][1][1][33] = 0; > END; > $$ LANGUAGE PLPGSQL; > When I run this function, I get: > ERROR: array subscript out