Re: Update Row Level Trigger: default value for update trigger

From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Theo Dickinson <Theo(dot)Dickinson(at)unv(dot)org>
Cc: "'pgsql-novice(at)postgresql(dot)org'" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Update Row Level Trigger: default value for update trigger
Date: 2004-05-21 15:10:10
Message-ID: m34qq94y0d.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Theo Dickinson <Theo(dot)Dickinson(at)unv(dot)org> writes:

> Within an update row level trigger how can I detect which field[s] has been
> effected by an update ?

You can compare OLD value with the NEW's one:

IF ( NEW.modified_by <> OLD.modified_by ) THEN
mod_by := 1; -- Use := for assigment

Note that in plpgsql the assigment operator is := and *not* = which
is a boolean operator for equality.

Regards,
Manuel.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Manuel Sugawara 2004-05-21 15:11:22 Re: postgre -> mysql
Previous Message Manuel Sugawara 2004-05-21 15:05:08 Re: Problem with public schema