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

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

On Friday 29 November 2002 02:28 am, you wrote:
> "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.
>
Thanks for the info. I was afraid of that.
I't not the tediousness that's the problem though, but that I don't
know the column names. And there might be 300 columns in this
view.
I guess it's read-only for the time being.

Cheers,

Han Holl

Browse pgsql-general by date

  From Date Subject
Next Message Peter Alberer 2002-11-29 10:06:53 What could cause total crash of a postgres installation?
Previous Message suresh s 2002-11-29 07:16:24 Help me in Database Versioning