Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0DHVXp65778 for ; Sat, 13 Jan 2001 12:31:33 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f0DHVLJ02303; Sat, 13 Jan 2001 12:31:21 -0500 (EST) To: Jan Wieck cc: Najm Hashmi , "pgsql-sql@postgresql.org" Subject: Re: pl/pgsql Limits In-reply-to: <200101131404.JAA01424@jupiter.jw.home> References: <200101131404.JAA01424@jupiter.jw.home> Comments: In-reply-to Jan Wieck message dated "Sat, 13 Jan 2001 09:04:59 -0500" Date: Sat, 13 Jan 2001 12:31:21 -0500 Message-ID: <2300.979407081@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200101/126 X-Sequence-Number: 787 Jan Wieck writes: >> As it is known that any funtion, written in pl/pgsql, can only >> retrun one tuple. I am just wondering it were true as well for function >> written in C language. I need to write few function that will retrun >> mulitiple rows satsifying a certain set of conditions. > We plan to tackle the problem for v7.2. It is possible for a C function to return a set (ie, multiple values returned over successive calls) as of 7.1; it's even documented, see src/backend/utils/fmgr/README. And you can return a tuple if you know how (this part is not documented, but you can crib it from the SQL-function support in backend/executor/functions.c). The real problem is that the rest of the system doesn't let you *do* anything very useful with either set-valued or tuple-valued functions. This is what we need to address in future releases. Ideally I think a function returning sets and/or tuples should be treated as a table source, so that you'd write ... FROM function(args) AS alias, ... regards, tom lane