Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 435CA476862; Wed, 25 Sep 2002 10:13:27 -0400 (EDT) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 6392A476800; Wed, 25 Sep 2002 10:13:11 -0400 (EDT) Received: by news.hub.org (Postfix, from userid 8) id 82ACB38174B; Wed, 25 Sep 2002 10:13:15 -0400 (EDT) From: Dmitry Tkach X-Newsgroups: comp.databases.postgresql.questions, comp.databases.postgresql.sql Subject: Re: database abstraction -> functions Date: Wed, 25 Sep 2002 10:03:22 -0400 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 23 Message-ID: <3D91C22A.2060500@openratings.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: news@hub.org To: Jeroen Olthof User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.7+) Gecko/20020123 X-Accept-Language: en-us To: pgsql-general@postgresql.org, pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/1118 X-Sequence-Number: 30699 Jeroen Olthof wrote: > Hi, > > When developing applications is a good thing to create abstraction between > different layers > The one concerning the database would be the persistence layer. To create > such abstraction I want all mij datababase activitie runned through > functions. But how can I return a set of rows instead of a single datatype > (I looked into the setof but never found a clear simple)? > A very simple answer - there is no way to do what you want :-( They promise to have it in 7.3... I am using a workaround, where my functions glue all the columns together into a pipe-separated line, that I then parse back into columns in my application... Also, note that, unless your functions are in C (anything like plpgsql, or just sql), they are slow like hell... In that case, you are much better off implementing your abstraction layer through views... Dima