Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html - Mailing list pgsql-general

From Tom Lane
Subject Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html
Date
Msg-id 25714.1124468967@sss.pgh.pa.us
Whole thread Raw
In response to Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html  (Adam Witney <awitney@sgul.ac.uk>)
Responses Re:  (Nigel Horne <njh@bandsman.co.uk>)
List pgsql-general
Adam Witney <awitney@sgul.ac.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: How to cancel a query if SIGINT does not work?
Next
From: Tom Lane
Date:
Subject: Re: question about plpgsql replace function