Scaler forms as function arguments

From: Andreas Tille <tillea(at)rki(dot)de>
To: PostgreSQL SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Scaler forms as function arguments
Date: 2003-11-26 15:40:26
Message-ID: Pine.LNX.4.56.0311261255210.17774@wr-linux02.rki.ivbb.bund.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2003-11-26 15:45:11 Re: Problem: Postgresql not starting
Previous Message Tom Lane 2003-11-26 15:40:08 Re: trigger conversion advice needed