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 C85F6D1B19D for ; Wed, 19 May 2004 14:33:49 -0300 (ADT) 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 18774-08 for ; Wed, 19 May 2004 14:33:30 -0300 (ADT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id CE696D1B169 for ; Wed, 19 May 2004 14:33:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i4JHXJ7w018521; Wed, 19 May 2004 13:33:20 -0400 (EDT) To: Martin Knipper Cc: pgsql-sql@postgresql.org Subject: Re: Function valid only for one table In-reply-to: <40AB94CF.90802@mk-os.de> References: <40AB7272.2090605@mk-os.de> <40AB8C4C.8080602@archonet.com> <40AB94CF.90802@mk-os.de> Comments: In-reply-to Martin Knipper message dated "Wed, 19 May 2004 19:09:35 +0200" Date: Wed, 19 May 2004 13:33:19 -0400 Message-ID: <18520.1084987999@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/169 X-Sequence-Number: 17883 Martin Knipper writes: > I thought about a mixture of object orientation and a normal table > for a relational database. > someFunction() is a method for the object/table someTable. Perhaps you could do what you want with functions accepting table rowtypes. create function someFunction(someTable) returns ... select someFunction(t.*) from someTable t where ... -- works select someFunction(t.*) from anotherTable t where ... -- fails create function someFunction(anotherTable) returns ... select someFunction(t.*) from someTable t where ... -- still works select someFunction(t.*) from anotherTable t where ... -- now calls the second someFunction() As of existing releases this doesn't scale well to large tables, because passing a whole table row to a function leaks memory intraquery. That is fixed for 7.5 though. regards, tom lane