From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | ??? <jqhan(at)db(dot)pku(dot)edu(dot)cn> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: inquiry about multi-row resultset in functions |
Date: | 2002-10-10 04:27:28 |
Message-ID: | 3DA501B0.2010502@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
??? wrote:
> dear hacker, hello. I want to know how to build a function of my own which
> returns rows of resultset, not just a row.
> Can anybody help me? Thank you in advance.
>
It is possible, but not very user friendly if you are using PostgreSQL 7.2.x
or before. See contrib/dblink/dblink.c for an example of how to write a C
function to do this. It is also possible in SQL language functions, but very
inefficient and difficult to use. Search the mail archives for examples. It is
not possible at all with PL/pgSQL in 7.2.x (or earlier).
In 7.3, which is currently in beta testing, creating a function returning a
resultset (also know as table functions) is much easier. Table functions can
be created using C, SQL, or PL/pgSQL languages. See:
http://developer.postgresql.org/docs/postgres/xfunc-tablefunctions.html
http://developer.postgresql.org/docs/postgres/xfunc-sql.html
http://developer.postgresql.org/docs/postgres/xfunc-c.html
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html
HTH,
Joe
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-10-10 04:47:34 | Re: GRANT on functions/languages |
Previous Message | 韩近强 | 2002-10-10 04:11:55 | inquiry about multi-row resultset in functions |