Re: Determine column name from trigger

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Envex Developments" <mwagner(at)envex(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Determine column name from trigger
Date: 2002-11-29 16:23:29
Message-ID: 22839.1038587009@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Envex Developments" <mwagner(at)envex(dot)net> writes:
> FOR x IN 1 .. 3 LOOP
> IF OLD.ux NOT = NEW.ux THEN

I think you'll have to bite the bullet and write it out as three
separate tests:

if old.u1 <> new.u1 then
...
end if;
if old.u2 <> new.u2 then
...
end if;
if old.u3 <> new.u3 then
...
end if;

You could possibly do something that iterates through the column names
in pltcl, but plpgsql doesn't have that much flexibility.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-11-29 16:24:20 Re: Memory leak with palloc
Previous Message Tom Lane 2002-11-29 16:08:58 Re: What could cause total crash of a postgres installation?