Hi,
I'm trying to return an array from a postgres function, but I keep
getting weird errors:
-- this works
CREATE OR REPLACE FUNCTION test(float4[])
RETURNS float4[]
AS '
BEGIN
RETURN $1;
END;'
LANGUAGE 'plpgsql';
select test('{1,2}');
-- but I want to change the values in the array:
CREATE OR REPLACE FUNCTION test(float4[])
RETURNS float4[]
AS '
DECLARE
a_return[] float4;
-- a_return[2] float4;
BEGIN
a_return[1] := 1;
select 2 into a_return[2];
RETURN a_return;
END;'
LANGUAGE 'plpgsql';
I just can't seem to declare an array. How should I be doing this?