X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id B680DD1CAC8 for ; Wed, 28 Jan 2004 16:02:57 +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 49475-01 for ; Wed, 28 Jan 2004 12:02:26 -0400 (AST) Received: from internet.potentialtech.com (h-66-167-251-6.PHLAPAFG.covad.net [66.167.251.6]) by svr1.postgresql.org (Postfix) with ESMTP id 81E26D1C9B8 for ; Wed, 28 Jan 2004 12:02:25 -0400 (AST) Received: from potentialtech.com (pa-plum1c-102.pit.adelphia.net [24.53.179.102]) by internet.potentialtech.com (Postfix) with ESMTP id 149B169A60; Wed, 28 Jan 2004 11:02:24 -0500 (EST) Message-ID: <4017DD0D.6040200@potentialtech.com> Date: Wed, 28 Jan 2004 11:02:21 -0500 From: Bill Moran User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031005 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Shridhar Daithankar Cc: pgsql-performance@postgresql.org Subject: Re: On the performance of views References: <40152FF2.8000007@potentialtech.com> <4015326A.8000706@frodo.hserus.net> <4016BE69.9050909@potentialtech.com> <200401271207.33551.josh@agliodbs.com> <4017764B.3080903@frodo.hserus.net> In-Reply-To: <4017764B.3080903@frodo.hserus.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/290 X-Sequence-Number: 5464 Shridhar Daithankar wrote: > Josh Berkus wrote: > >> Bill, >> >>> Some functions they prototyped in MSSQL even return different types, >>> based >>> on certian parameters, I'm not sure how I'll do this in Postgres, but >>> I'll >>> have to figure something out. >> >> We support that as of 7.4.1 to an extent; check out "Polymorphic >> Functions". > > To my understanding, polymorphism means more than one function with same > name but different signature(Sorry C++ days!!). > > That still can not return rwos of two types in one call. At any moment, > rowset returned by a function call would be homogenous. > > Is MSSQL allows to mix rows of two types in single function invocation, > I am sure that would be a hell lot of porting trouble.. These are two seperate problems. 1) Returning a homogenious set of rows, but the composition of those rows will not be known until run time, as a different set of logic will be done depending on the values of some parameters. 2) Returning what MSSQL calls "combined recordsets", which are many rows, but the rows are not homogenious. As I see it, #1 can be solved by polymorphism in Postgres functions. #2 has to be solved at the application level. My solution so far has been to create multiple Postgres functions, call each one in turn, join the results in C, and return them as a structure via SOAP to the client. May not be the easiest way to get it working, but it's working so far. (although I'm always open to suggestions if someone knows of a better way) -- Bill Moran Potential Technologies http://www.potentialtech.com