Search Postgresql Archives

array function problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a array function
CREATE OR REPLACE FUNCTION "temp".rowfromarray(text[])
  RETURNS SETOF text AS
$BODY$DECLARE
    _return    text;
BEGIN
    for i in 1..array_upper($1,1) loop
        _return := $1[i];
        return next _return;
    end loop;
    return;
END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION "temp".rowfromarray(text[]) OWNER TO postgres;

I call it by command
select temp.rowfromarray(string_to_array('1,2,3,4,5', ','));
but it have error

ERROR:  set-valued function called in context that cannot accept a set
CONTEXT:  PL/pgSQL function "rowfromarray" line 6 at RETURN NEXT

********** Error **********

ERROR: set-valued function called in context that cannot accept a set
SQL state: 0A000
Context: PL/pgSQL function "rowfromarray" line 6 at RETURN NEXT

When i debug it by pass {1,2,3,4,5} to first parameter, it run well.

Please help me.
Thanks you very much. Sorry for my English.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux