Re: - Mailing list pgsql-general

From Nigel Horne
Subject Re:
Date
Msg-id 1124701550.4246.11.camel@laptop1.home-network2.net
Whole thread Raw
In response to Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re:  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Fri, 2005-08-19 at 17:29, Tom Lane wrote:
> 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.

It strikes me that there are two problems with this approach:

1) It stores the return values in the database, that seems a waste
2) It's slightly more complicated in that I have to delete the
return values from the previous call before inserting the return
values from this call, making it even more complex and slow.

>
>             regards, tom lane

-Nigel


pgsql-general by date:

Previous
From: Dick Kniep
Date:
Subject: pg_restore and schema's
Next
From: "Surabhi Ahuja "
Date:
Subject: Re: threads and transaction ...sample code and stored procedure