On Sat, Mar 25, 2006 at 12:17:08AM +0100, PFC wrote: > > > CREATE OR REPLACE FUNCTION foreach( liste INTEGER[] ) RETURNS SETOF > INTEGER AS $$ > DECLARE > i INTEGER; > BEGIN > FOR i IN 1..icount(liste) LOOP > RETURN NEXT liste[i]; > END LOOP; > END; > $$ LANGUAGE plpgsql;
Seems like this should really exist in the backend... > CREATE AGGREGATE array_accum ( > sfunc = array_append, > basetype = anyelement, > stype = anyarray, > initcond = '{}' > ); > > SELECT array_accum( DISTINCT list_id ) FROM bookmarks; > array_accum > --------------- > {1,2,3,4,5,7} Couldn't you just use array()? -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match