Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adam Witney <awitney(at)sgul(dot)ac(dot)uk>
Cc: Nigel Horne <njh(at)bandsman(dot)co(dot)uk>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html
Date: 2005-08-19 16:29:27
Message-ID: 25714.1124468967@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adam Witney <awitney(at)sgul(dot)ac(dot)uk> writes:
> Ah you want to return a record I suppose?

> CREATE TABLE test (id int, name text);
> INSERT INTO test VALUES(1, 'me');
> INSERT INTO test VALUES(2, 'you');

> CREATE FUNCTION test_func() RETURNS SETOF record AS '
> SELECT id, name FROM test;
> ' LANGUAGE SQL;

Or better, "RETURNS SETOF test", so you don't have to describe the
output record type every time you call it.

regards, tom lane

In response to

Responses

  • Re: at 2005-08-22 09:05:50 from Nigel Horne

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-08-19 16:30:43 Re: question about plpgsql replace function
Previous Message Tom Lane 2005-08-19 16:27:31 Re: How to cancel a query if SIGINT does not work?