From: | Adam Witney <awitney(at)sgul(dot)ac(dot)uk> |
---|---|
To: | Nigel Horne <njh(at)bandsman(dot)co(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: http://www.postgresql.org/docs/8.0/static/xfunc-sql.html |
Date: | 2005-08-22 09:29:42 |
Message-ID: | BF2F5996.4B35D%awitney@sgul.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 22/8/05 10:19 am, "Nigel Horne" <njh(at)bandsman(dot)co(dot)uk> wrote:
> 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.
>
> Seeing as there will only ever be one row in this table, do I need the
> SETOF field?
Try it and see.... I think you don't need it for a single row.
adam
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
From | Date | Subject | |
---|---|---|---|
Next Message | Nigel Horne | 2005-08-22 09:44:55 | Re: |
Previous Message | Surabhi Ahuja | 2005-08-22 09:20:45 | Re: threads and transaction ...sample code and stored procedure |