From: Tom Lane <tgl@sss.pgh.pa.us>
To: Martin Knipper <knipper@mk-os.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: Function valid only for one table
Date: Wed, 19 May 2004 13:33:19 -0400
Message-ID: <18520.1084987999@sss.pgh.pa.us> (raw)
In-Reply-To: <40AB94CF.90802@mk-os.de>
References: <40AB7272.2090605@mk-os.de>
<40AB8C4C.8080602@archonet.com>
<40AB94CF.90802@mk-os.de>
Martin Knipper <knipper@mk-os.de> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, knipper@mk-os.de
Subject: Re: Function valid only for one table
In-Reply-To: <18520.1084987999@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox