Search Postgresql Archives

Re: PL/PGSQL: why IF test the whole condition before failing or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Suporte PK <fknoedt@xxxxxxxxx> writes:
> IF TG_OP = 'UPDATE' AND OLD.field != NEW.field THEN
> ...
> The question is: if the trigger was not fired by an UPDATE event, 
> shouldn't it make the first test and then ignore the rest of the condition?

No.  This is a very very common error.  The behavior is not as
short-circuity as you'd think.  Break it into two IFs.

			regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux