Thread: function returning arrays?

function returning arrays?

From
stevew
Date:
Hi there,

Can a function return an array?
I tried:
create function my_func() returns int4[] as
'select a_value from a_table where b_value = 1;'
language 'sql';

The parser don't like int4[]

What about a function returning an array of instances, is this possible?
create function my_func(a_value) returns my_table[] as
'select * from my_table where <a clause including the passed arg> ;'
language 'sql';

Though I guess this is probably best done with a view?

Any comments appreciated.

Steve W