On 1-10-2018 18:18, Kovalenko Dmitry wrote:
Hello,

Firebird 3.0.4

Could anybody (Adriano?) confirm, that next result is corrected:

select

null   or true    as c4__null_or_true,      /*  TRUE */

null   or false   as c5__null_or_false,   /* NULL */

null   and true   as c6__null_and_true, /* NULL */

null   and false  as c7__null_and_false /* FALSE */

from rdb$database

Just – yes or no :)

Yes, and verified against SQL:2016.

You can reason about if you substitute TRUE and FALSE for NULL (or UNKNOWN as for booleans that is interchangeable) and see how that influences the result.

For (UNKNOWN or TRUE), you can reason that whether UNKNOWN is replaced with TRUE or FALSE, the result is TRUE, so UNKNOWN is irrelevant for the result.

But for (UNKNOWN or FALSE), you can't because if replaced with TRUE, the result is TRUE, but with FALSE the result is FALSE. That means that UNKNOWN decides the result, so the result is UNKNOWN.

Same for AND:

(UNKNOWN and FALSE), whether you replace with TRUE or FALSE, the result is FALSE.

And for (UNKNOWN and TRUE), UNKNOWN decides the result: if you replace with TRUE, the result is TRUE, with FALSE, the result is FALSE.

Mark
--
Mark Rotteveel


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to