Re: [SQL] Looking for a way to sum integer arrays....

2005-04-29 Thread Ramakrishnan Muralidharan
Hi, CREATE OR REPLACE FUNCTION SUM_ARR( aArr1 Integer[] , aArr2 Integer[] ) RETURNS Integer[] AS $$ DECLARE aRetu Integer[]; BEGIN -- Initialize the Return array with first array value. FOR i IN array_lower( aArr1 )..array_upper( aArr1 ) LOOP array_append( aRetu , aArr1[i] ); END L

Re: [SQL] Looking for a way to sum integer arrays....

2005-04-29 Thread Tony Wasson
Thank you for the responses! To recap: pl/r array support works very well. In my case, I am looking for pl/pgsql solution. I also got this nice function from dennisb on the #postgresql irc channel, which seems extremely "clean" and works with 7.4/8.0. My original function didn't handle a blank i

Re: [SQL] Looking for a way to sum integer arrays....

2005-04-23 Thread Sean Davis
You would definitely want to look into using pl/R for this. Also, other procedure languages (perl, for example) work well with arrays so may be easier to use for this situation. As for the aggregate, I don't know how to make that more dynamic in terms of return value. Sean - Original Mess