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

2005-08-22 Thread Tom Lane
Nigel Horne <[EMAIL PROTECTED]> writes: > 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

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

2005-08-22 Thread Adam Witney
On 22/8/05 10:19 am, "Nigel Horne" <[EMAIL PROTECTED]> wrote: > On Fri, 2005-08-19 at 17:29, Tom Lane wrote: >> Adam Witney <[EMAIL PROTECTED]> 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

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

2005-08-19 Thread Tom Lane
Adam Witney <[EMAIL PROTECTED]> 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; > ' LANG

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

2005-08-19 Thread Adam Witney
On 19/8/05 4:38 pm, "Nigel Horne" <[EMAIL PROTECTED]> wrote: > On Fri, 2005-08-19 at 16:30, Adam Witney wrote: >>> I can't work out from that how to return more than one value. >> >> Hi Nigel, >> >> Add SETOF to your function like so: >> >> CREATE TABLE test (id int); >> INSERT INTO test VALUES

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

2005-08-19 Thread Adam Witney
> I can't work out from that how to return more than one value. Hi Nigel, Add SETOF to your function like so: CREATE TABLE test (id int); INSERT INTO test VALUES(1); INSERT INTO test VALUES(2); CREATE FUNCTION test_func() RETURNS SETOF integer AS ' SELECT id FROM test; ' LANGUAGE SQL; SE

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

2005-08-19 Thread A. Kretschmer
am 19.08.2005, um 15:58:20 +0100 mailte Nigel Horne folgendes: > I can't work out from that how to return more than one value. 17:35 < rtfm_please> For information about srf 17:35 < rtfm_please> see http://techdocs.postgresql.org/guides/SetReturningFunctions 17:35 < rtfm_please> or http://www.p