Thread: one pl/pgsql question
CREATE FUNCTION cashint(int4) RETURNS text AS ' DECLARE value ALIAS for $1; result text; BEGIN result=value::text; RETURN result; END; ' LANGUAGE 'plpgsql'; select cashint(2); cashint --------- 2 (1 row) this is correct nut when I' trying to get an array as return value it throws an error CREATE FUNCTION cashint(int4) RETURNS text[] AS ' DECLARE value ALIAS for $1; result text[]; BEGIN result[1]=value::text; RETURN result; END; ' LANGUAGE 'plpgsql'; select cashint(2); NOTICE: plpgsql: ERROR during compile of cashint near line 5 ERROR: parse error at or near "[" Is an array in this use not supported or am I totally wrong? Ewald
Ewald Geschwinde <webmaster@geschwinde.net> writes: > Is an array in this use not supported or am I totally wrong? It's not supported :-(. plpgsql's support for array variables is not quite nonexistent, but close to it. regards, tom lane
lør, 2002-01-19 kl. 18:41 skrev Tom Lane: > It's not supported :-(. plpgsql's support for array variables is > not quite nonexistent, but close to it. So, this is why it is not possible to declare a "SIZEOF ...", but as a return type ? /BL