Returning multiple rows in functions

From: Kief Morris <k(dot)morris(at)bitbull(dot)com>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Returning multiple rows in functions
Date: 2000-03-06 15:54:42
Message-ID: 30C64922AF42D311A96D00A0C91D0B107EB54D@mailpost.syzygy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm missing something in the docs - how can I write a function
that returns multiple rows? I want to do the equivalent of:

select name from user_category where id = 21;

I create the following function:

create function getid (int4) returns text as 'select name from mytable
where id = $1;' language 'sql';

... but it only returns the first matching row. Is there
a way to return all the matching rows?

Thanks,
Kief

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ross J. Reedstrom 2000-03-06 16:24:33 Re: [SQL] index file's growing big
Previous Message Justin Long 2000-03-06 15:31:39 Selecting random element?