From: Andreas Tille <tillea@rki.de>
To: PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: Scaler forms as function arguments
Date: Wed, 26 Nov 2003 16:40:26 +0100 (CET)
Message-ID: <Pine.LNX.4.56.0311261255210.17774@wr-linux02.rki.ivbb.bund.de> (raw)
Hi,
I want to write a function of the following type
CREATE FUNCTION test ( <scalar form type> )
RETURNS setof MyTable
AS
'SELECT * FROM MyTable WHERE id IN $1'
LANGUAGE 'SQL' ;
I was not able to find a reference whether this is possible and if yes
how to specify the argument type and how to call this function to hand over
the list for the IN clause correctly.
Next question. Is there any example how to return a SETOF MyTable in
a plpgsql function? I tried
CREATE FUNCTION test2()
RETURNS setof MyTable
AS '
DECLARE
result SETOF MyTable ;
BEGIN
result := (SELECT * FROM MyTable);
RETURN result ;
END; ' LANGUAGE 'plpgsql';
wich failed.
Kind regards
Andreas.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tillea@rki.de
Subject: Re: Scaler forms as function arguments
In-Reply-To: <Pine.LNX.4.56.0311261255210.17774@wr-linux02.rki.ivbb.bund.de>
References: <Pine.LNX.4.56.0311261255210.17774@wr-linux02.rki.ivbb.bund.de>
* 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