Subject | Re: The New command in triggers |
---|---|
Author | Svein Erling Tysvær |
Post date | 2006-02-16T08:46:34Z |
--- In firebird-support@yahoogroups.com, Milan Babuskov wrote:
my sense of logic. If you'd said that
NULL and TRUE
or
NULL or FALSE
I would agree that the end result should be NULL. But
NULL or TRUE
should in my opinion return TRUE. Let's take an example. Does Milan or
Set have a telephone?
I don't know whether you have any telephone, but I do know that I have
one. Hence, I would expect the answer to the question above to be YES.
And Firebird is normally quite logical.
Set
> Adam wrote:Are you sure, Milan? I haven't checked Firebird, but this goes against
> > If you consider NULL = NULL for the purpose of comparison, then
> > you will need to check each field like this.
> >
> > IF ((OLD.FIELD <> NEW.FIELD) OR
> > (OLD.FIELD IS NOT NULL AND NEW.FIELD IS NULL) OR
> > (OLD.FIELD IS NULL AND NEW.FIELD IS NOT NULL)) THEN .....
>
> I believe this has to be done the other way around. First check for
> NULLs, and then the values. The reason is that expression is
> evaluated from left to right. So, if one of the values is NULL, you
> get:
>
> NULL or TRUE
>
> or
>
> NULL or FALSE or TRUE
>
> In any case, the final result in NULL, meaning that IF clause won't
> get executed.
>
> If you check for NULLs first, it runs into TRUE and stops the
> further checking.
my sense of logic. If you'd said that
NULL and TRUE
or
NULL or FALSE
I would agree that the end result should be NULL. But
NULL or TRUE
should in my opinion return TRUE. Let's take an example. Does Milan or
Set have a telephone?
I don't know whether you have any telephone, but I do know that I have
one. Hence, I would expect the answer to the question above to be YES.
And Firebird is normally quite logical.
Set