X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4BEE5D1CCB1 for ; Thu, 29 Jan 2004 23:19:04 +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 64493-06 for ; Thu, 29 Jan 2004 19:18:35 -0400 (AST) Received: from davinci.ethosmedia.com (server228.ethosmedia.com [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id C3F5ED1B45C for ; Thu, 29 Jan 2004 19:18:31 -0400 (AST) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 4337912; Thu, 29 Jan 2004 15:19:36 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Bill Moran Subject: Re: [PERFORM] Set-Returning Functions WAS: On the performance of views Date: Thu, 29 Jan 2004 15:17:19 -0800 User-Agent: KMail/1.4.3 Cc: pgsql-sql@postgresql.org References: <40152FF2.8000007@potentialtech.com> <200401291121.54048.josh@agliodbs.com> <4019629C.3040307@potentialtech.com> In-Reply-To: <4019629C.3040307@potentialtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200401291517.19647.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/276 X-Sequence-Number: 16669 Bill, > I don't understand at all. If I do "SELECT * FROM > set_returning_function()" and all I'm going to do is iterate through the > columns and rows, adding them to a two dimensional array that will be > marshalled as a SOAP message, what about not knowing the nature of the > return set can cause me to get no data? Because that's not the syntax for a function that returns SETOF RECORD. The syntax is: SELECT * FROM set_returning_function(var1, var2) AS alias (col1 TYPE, col2 TYPE); That is, if the function definition does not contain a clear row structure, the query has to contain one. This does not apply to functions that are based on a table or composite type: CREATE FUNCTION .... RETURNS SETOF table1 ... CREATE FUNCTION .... RETURNS SETOF comp_type Can be called with: SELECT * FROM some_function(var1, var2) as alias; What this means is that you have to know the structure of the result set, either at function creation time or at function execution time. > > One of the things I love about working with open source databases is I > don't see a lot of that. The people on these lists are almost always > smarter than me, and I find that comforting ;) Flattery will get you everywhere. -- Josh Berkus Aglio Database Solutions San Francisco