Re: How to access OLD and NEW with rule on update

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Han Holl" <han(dot)holl(at)prismant(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to access OLD and NEW with rule on update
Date: 2002-11-29 01:28:55
Message-ID: 18513.1038533335@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Han Holl" <han(dot)holl(at)prismant(dot)nl> writes:
> I need to call a function when updating on a view, like :

> create rule udps_upd as on update to udps do
> instead select function_call();

> My problem: how do I get a reference to OLD and NEW ?

> I tried function_call(OLD, NEW) -- parse error

I think you'll need to do it as

function_call(old.col1, old.col2, ..., new.col1, new.col2, ...)

Pretty tedious :-( but the rule rewriter doesn't support whole-row
references to OLD or NEW.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Justin Clift 2002-11-29 01:44:15 Re: PostgreSQL Global Development Group Announces Version 7.3
Previous Message Tom Lane 2002-11-29 01:04:10 Re: Server v7.3RC2 Dies