| From: | "Yuan Lin" <yuanlin(at)mail(dot)nwpu(dot)edu(dot)cn> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | A question about "table function" |
| Date: | 2003-03-18 03:14:49 |
| Message-ID: | b562uc$1nul$1@news.hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
hi, all:
When I see the following definitions from postgresql document. I am
completely puzzeled.
CREATE TABLE foo (fooid int, foosubid int, fooname text);
>> As I say it, foo is already a set of columns.
CREATE FUNCTION getfoo(int) RETURNS setof foo AS '
SELECT * FROM foo WHERE fooid = $1;
' LANGUAGE SQL;
>> here return type should be "setof setof foo".
----------------------------------------------------------------------------
-----------------
Can I rewrite the definition as follows:
CREATE TYPE foo (fooid int, foosubid int, fooname text);
CREATE FUNCTION getfoo(int) RETURNS setof foo AS '
SELECT * FROM foo WHERE fooid = $1;
' LANGUAGE SQL;
----------------------------------------------------------------------------
-------------------
any comments are appriciate.
JACK DULL
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Keiko Kondo | 2003-03-18 03:52:52 | Re: My contract has been renewed |
| Previous Message | Bruce Momjian | 2003-03-18 01:41:53 | Re: My contract has been renewed |