Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 40A40475AA1 for ; Tue, 21 Jan 2003 05:06:29 -0500 (EST) Received: from localhost.localdomain (unknown [216.31.142.3]) by postgresql.org (Postfix) with ESMTP id 6AB48474E5C for ; Tue, 21 Jan 2003 05:06:28 -0500 (EST) Received: from larubber.com (server [127.0.0.1]) by localhost.localdomain (8.11.6/8.11.6) with SMTP id h0LAe2P14848 for ; Tue, 21 Jan 2003 02:40:02 -0800 Received: from 216.86.192.34 (SquirrelMail authenticated user ddurst) by www.la-rubber.com with HTTP; Tue, 21 Jan 2003 02:40:02 -0800 (PST) Message-ID: <52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com> Date: Tue, 21 Jan 2003 02:40:02 -0800 (PST) Subject: returning setof in plpgsql From: "David Durst" To: X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Reply-To: ddurst@larubber.com X-Mailer: SquirrelMail (version 1.2.7) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/315 X-Sequence-Number: 11180 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??