function returning arrays? - Mailing list pgsql-sql

From stevew
Subject function returning arrays?
Date
Msg-id 171315903.9662403.90@erica
Whole thread Raw
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] Slashdot Query
Next
From: Vikrant Rathore
Date:
Subject: Mail about duplicate rows