Re:

From: Nigel Horne <njh(at)bandsman(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Adam Witney <awitney(at)sgul(dot)ac(dot)uk>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2005-08-22 09:05:50
Message-ID: 1124701550.4246.11.camel@laptop1.home-network2.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2005-08-19 at 17:29, Tom Lane wrote:
> 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.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Surabhi Ahuja 2005-08-22 09:20:45 Re: threads and transaction ...sample code and stored procedure
Previous Message Dick Kniep 2005-08-22 07:30:36 pg_restore and schema's