function returning arrays?

From: stevew <stevew(at)bigeric(dot)force9(dot)co(dot)uk>
To: "'postgres post'" <pgsql-sql(at)postgresql(dot)org>
Subject: function returning arrays?
Date: 1999-06-06 18:44:00
Message-ID: 171315903.9662403.90@erica
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Vikrant Rathore 1999-06-07 02:33:42 Mail about duplicate rows
Previous Message Tom Lane 1999-06-06 15:16:00 Re: [SQL] Slashdot Query