Subject Odp: [firebird-support] Bug? Come back
Author liviuslivius@poczta.onet.pl
Hi,

Too much work and too big discussion change my first clear view on it ;-)
One coffee and i am back :)
False or undef is undef
not undef is still undef

Than all is ok
Thanks again and for your patience

Regards,
Karol Bieniaszewski

----- Reply message -----
Od: "Kjell Rilbe" <kjell.rilbe@...>
Do: "firebird-support@yahoogroups.com" <firebird-support@yahoogroups.com>
Temat: Odp: [firebird-support] Bug? Come back
Data: śr., maj 7, 2014 10:26


 


Kjell Rilbe skriver:

>
> liviuslivius@... skriver:
> >
> > Hi,
> >
> > I back with this question. Is this really correct because after
> > discussion with team i have now doubt.
> >
> > We have here parenthesis. Any expression in parenthesis should be
> > first calculated
> > Then this is not test
> > NOT NULL - > NULL only
> > Not ( NULL -> NULL)
> >
>
> What do you mean with that last line "Not (NULL -> NULL)"?
>
> Think of "NULL" as "UNKNOWN" and add that if the value is forced to
> true/false NULL evaluates to false, the logic becomes rather intuitive:
>
> 1. "if NULL then 1 else 2 end" returns 2
>
> 2. "if not NULL then 1 else 2 end" returns 2 because "not NULL" is NULL
> and the expression degenerates to the same as example 1 above.
>
> Regards,
> Kjell
>

Sorry, that should be "case when..." not "if...". Same goes for where
clauses. Also, note that boolean operators and and or always return NULL
if either operand is NULL and that operand has any significance in the
expression, so it's not until the entire expression is evaluated and a
yes/no decision HAS to be made, that NULL degenerates to false:

where NULL and true

will not return any records, because "NULL and true" evaluates to "NULL"
which then degenerates to false. But

where NULL or true

will return all records, because the expression will be true no matter
what the unknown value would be, so "NULL or true" evaluates to true.

Regards,
Kjell