returning setof in plpgsql - Mailing list pgsql-sql

From David Durst
Subject returning setof in plpgsql
Date
Msg-id 52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com
Whole thread Raw
Responses Re: returning setof in plpgsql  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Re: returning setof in plpgsql  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
I have a function that I want to return setof a table in plpgsql.

Here is what I have:

CREATE FUNCTION lookup_account(varchar(32)) RETURNS SETOF accounts AS '
DECLARE aname ALIAS FOR $1; rec RECORD;
BEGIN select into rec * from accounts where accountname = aname; return rec;
END;'
LANGUAGE 'plpgsql';

This seems to hang when I attempt to select it using:

select accountid(
lookup_account('some account')),
accountname(lookup_account('some account')),
type(lookup_account('some account')),
balance(lookup_account('some account'));

Does anyone see a problem w/ my approach??





pgsql-sql by date:

Previous
From: "Moritz Lennert"
Date:
Subject: performance question
Next
From: Bruno Wolff III
Date:
Subject: Re: [OT] Unsubscribe does not work