On Thu, Feb 16, 2012 at 9:48 AM, ChoonSoo Park 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"=>
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); -- #
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 fun