Re: Update Row Level Trigger: default value for update trigger - Mailing list pgsql-novice

From Manuel Sugawara
Subject Re: Update Row Level Trigger: default value for update trigger
Date
Msg-id m34qq94y0d.fsf@conexa.fciencias.unam.mx
Whole thread Raw
In response to Update Row Level Trigger: default value for update trigger  (Theo Dickinson <Theo.Dickinson@unv.org>)
List pgsql-novice
Theo Dickinson <Theo.Dickinson@unv.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.

pgsql-novice by date:

Previous
From: Manuel Sugawara
Date:
Subject: Re: Problem with public schema
Next
From: Manuel Sugawara
Date:
Subject: Re: postgre -> mysql