Rules: passing new/old to functions

From: Gunter Diehl <gdid(at)gmx(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: Rules: passing new/old to functions
Date: 2003-06-22 20:28:12
Message-ID: 11362.1056313692@www59.gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

How to pass the special variables new / old to functions?

e.g. I'd like to to something like this (v is a view):

create funtion f1(v, v) returns void as '...'
create rule vupt as on update to v do instead select f1(new, old)

While accepting this definitions, pg says it can not handle "whole-tuple
references" at runtime.

using: select f(new) from new doesn't work either: pg says relation new
doesn't exist.

Since I need to handle tables with more than 20 columns, it would be uggly
if I had to pass every single value to the function as follows:
select f1(new.1, ..., new.n, old.1, ..., old.n)
create function f1(typeof 1, ..., typeof n, typeof 1, ..., typeofn)

I'd be glad for any kind of suggestion.

regards,
Gunter

--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Janning Vygen 2003-06-22 20:34:39 Re: Informing end-user of check constraint rules
Previous Message Germán Gutiérrez 2003-06-22 18:33:06 Re: Delete duplicates