Re: Implementation of boolean types.

From: Marshall Spight <marshall.spight_at_gmail.com>
Date: 14 Jul 2005 12:12:20 -0700
Message-ID: <1121368340.641036.231780_at_g47g2000cwa.googlegroups.com>


-CELKO- wrote:
>
> Nobody is sure and that is a serious problem with that extension.

Honestly, I just don't see the problem. You have two nullable 3VL booleans, it's very simple what they do:

OP1 OP2 AND OR


TRUE     TRUE     TRUE     TRUE
FALSE    TRUE     FALSE    TRUE
NULL     TRUE     NULL     NULL
UNKNOWN  TRUE     UNKNOWN  TRUE

TRUE     FALSE    FALSE    TRUE
FALSE    FALSE    FALSE    FALSE
NULL     FALSE    NULL     NULL

UNKNOWN FALSE FALSE FALSE
TRUE     NULL     NULL     NULL
FALSE    NULL     NULL     NULL
NULL     NULL     NULL     NULL
UNKNOWN  NULL     NULL     NULL

TRUE     UNKNOWN  TRUE     TRUE
FALSE    UNKNOWN  FALSE    UNKNOWN
NULL     UNKNOWN  NULL     NULL

UNKNOWN UNKNOWN UNKNOWN UNKNOWN It's simple: NULLs always propogate, and UNKNOWN is evanescent.

AND is only true if op1 and op2 are true, which they might be if unknown, but won't be if it's null, unless it's Tuesday in which case you should not use AND. OR is true if either operand is true, which about 50% of UNKNOWN values are, so UNKNOWN OR UNKNOWN should return TRUE 75% of the time, from basic probability theory. However, if you're using a quantum computer with 4VL, please remember that UNKNOWN is both TRUE and FALSE at the same time.

Also, in the FRENCH standard, UNKNOWN is written "JENESAISPAS" and the value of TRUE OR JENESAISPAS is DACCORD, except in Belgian French which specifies NULL. In Texas, UNKNOWN AND UNKNOWN returns BULLSHIT.

Sure, you *could* just limit yourself to 2VL. But honestly, isn't knowing how the boolean operators are going to turn out kind of boring? You wouldn't read the last page a book before you read the beginning, would you?

Marshall Received on Thu Jul 14 2005 - 21:12:20 CEST

Original text of this message