I'd like to add that a NULL value might mess things up. If CreateTime may be
null, try this:
if (OLD.CreateTime <> NEW.CreateTime) OR
(OLD.CreateTime ISNULL <> NEW.CreateTime ISNULL) THEN ...
if COALESCE(OLD.CreateTime, '3001-01-01') <>
COALESCE(NEW.CreateTime, '3001-01-01') THEN ...
(provided you can safely assume that createtimes remain in this millenium
if COALESCE(OLD.CreateTime <> NEW.CreateTime,
OLD.CreateTime ISNULL <> NEW.CreateTime ISNULL) THEN ...
However; I'd stay with the first one. It's quite simple and Y3K-safe ;)
Also, it seems to be the most effective of them, if any.
%----------------------- cut here -----------------------%
----- Original Message -----
From: "Richard Huxton" <dev(at)archonet(dot)com>
Sent: Wednesday, July 07, 2004 1:03 PM
> Pradeepkumar, Pyatalo (IE10) wrote:
> > Thanks a lot for ur help.
> > In the trigger, I am checking if a field is updated or not. The syntax
> > use is
> > IF UPDATE(CreateTime) THEN
> > ....
> > ....
> > END IF;
> > Is this syntax correct.
> No, and I don't recall seeing anything like it in the manuals.
> IF OLD.CreateTime <> NEW.CreateTime THEN
In response to
pgsql-sql by date
|Next:||From: Gerwin Philippo||Date: 2004-07-08 12:53:29|
|Subject: Re: append columns that are null|
|Previous:||From: SZŰCS Gábor||Date: 2004-07-08 11:09:54|
|Subject: Constraint->function dependency and dump in 7.3|