Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group