[GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread ChoonSoo Park
I would like to construct hstore array from 2 dimensional array. For example, '{{f1, 1, f2, 123, f3, ABC, ...}, {f1, 2, f2, 345, f3, DEF, ...}}' Should be converted to 2 hstore values f1=1, f2=123, f3=ABC, ... f2=2, f2=345, f3=DEF, ... create or replace function convertHStore(p1

Re: [GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread Bartosz Dmytrak
Hi, this could be start point for discussion: CREATE OR REPLACE FUNCTION public.arraysToHstore (IN a TEXT[], OUT c hstore[]) RETURNS hstore[] AS $BODY$ DECLARE i INT; elements INT; dim INT; BEGIN elements := array_length(a,2); -- # of elements in each dimension dim := array_length(a,1); -- #

Re: [GENERAL] How to dereference 2 dimensional array?

2012-02-16 Thread Merlin Moncure
On Thu, Feb 16, 2012 at 9:48 AM, ChoonSoo Park luisp...@gmail.com wrote: I would like to construct hstore array from 2 dimensional array. For example, '{{f1, 1, f2, 123, f3, ABC, ...}, {f1, 2, f2, 345, f3, DEF, ...}}' Should be converted to 2 hstore values f1=1, f2=123, f3=ABC, ...