X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 10309D1B435 for ; Wed, 26 Nov 2003 15:41:06 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63441-03 for ; Wed, 26 Nov 2003 11:40:39 -0400 (AST) Received: from Ulm.bund.de (Ulm.bund.de [194.95.179.208]) by svr1.postgresql.org (Postfix) with ESMTP id F07E1D1B446 for ; Wed, 26 Nov 2003 11:40:33 -0400 (AST) Received: (from root@localhost) by Ulm.bund.de (8.9.3p2/8.9.3) id QAA03235 for ; Wed, 26 Nov 2003 16:40:24 +0100 Date: Wed, 26 Nov 2003 16:40:26 +0100 (CET) From: Andreas Tille X-X-Sender: tillea@wr-linux02.rki.ivbb.bund.de To: PostgreSQL SQL Subject: Scaler forms as function arguments Message-Id: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 26 Nov 2003 15:32:54.0937 (UTC) FILETIME=[8FBC9090:01C3B432] X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/292 X-Sequence-Number: 16107 Hi, I want to write a function of the following type CREATE FUNCTION test ( ) 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.