pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Durst <ddurst@larubber.com>
To: pgsql-sql@postgresql.org
Subject: returning setof in plpgsql
Date: Tue, 21 Jan 2003 02:40:02 -0800 (PST)
Message-ID: <52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com> (raw)

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??






view thread (4+ messages)  latest in thread

Message-ID: <52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com>
Permalink:  ../52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com/
Also on:    postgresql.org/message-id/52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ddurst@larubber.com
  Subject: Re: returning setof in plpgsql
  In-Reply-To: <52900.216.86.192.34.1043145602.squirrel@www.la-rubber.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox