Re: Update Trigger Inconsistency with 7.1? - Mailing list pgsql-general

From Tom Lane
Subject Re: Update Trigger Inconsistency with 7.1?
Date
Msg-id 3381.980535531@sss.pgh.pa.us
Whole thread Raw
In response to Update Trigger Inconsistency with 7.1?  ("Gregory Wood" <gregw@com-stock.com>)
List pgsql-general
"Gregory Wood" <gregw@com-stock.com> writes:
> To do this I created a trigger that would raise an exception "IF
> new.UpdateRequired ISNULL". In 7.0 this would work because
> new.UpdateRequired seemed to be NULL unless it was specified (I cannot test
> this any longer because I don't have a 7.0 server available).

I find that very hard to believe.  The NEW record contains the proposed
new tuple, which will include the old value of any fields that weren't
specified in the UPDATE statement.

You can detect whether a field is actually being *changed* by comparing
NEW.field and OLD.field.  You cannot distinguish the case where the
UPDATE didn't mention a field from the case where it did but assigned
the same value that was already there (eg UPDATE foo SET x = x).
This behavior was not different in 7.0.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Performance: Unix sockets vs. TCP/IP sockets
Next
From: Doug McNaught
Date:
Subject: Re: Performance: Unix sockets vs. TCP/IP sockets