Re: Triggers on columns - Mailing list pgsql-hackers

From Itagaki Takahiro
Subject Re: Triggers on columns
Date
Msg-id 20090903112659.3127.52131E4D@oss.ntt.co.jp
Whole thread Raw
In response to Re: Triggers on columns  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Triggers on columns
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> wrote:

> Wow, so I wouldn't have to do this any more?
> 
> IF (TG_OP = 'UPDATE') THEN
>     IF (OLD.foo IS NOT DISTINCT FROM NEW.foo AND OLD.bar IS NOT
> DISTINCT FROM NEW.bar
>          AND OLD.baz IS NOT DISTINCT FROM NEW.baz) THEN
>         RETURN NULL;
>     END IF;
> END IF;

Sure, and I found there might be difference between "UPDATE" and
"UPDATE OF {all-columns}" triggers. UPDATE trigger is always fired
when a row is updated even if none of the columns are actually
modified, but UPDATE OF {all-columns} trigger is fired only when
at least one of the columns is modified.

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center




pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Schedule for 8.5 Development
Next
From: Robert Haas
Date:
Subject: Re: Schedule for 8.5 Development