> -----Original Message----- > From: Roger Baklund [mailto:[EMAIL PROTECTED]
> This definition (from the manual) is self-contradicting: 1 OR NULL > should evaluate to 1 because "any operand is non-zero", but it should > also evaluate to NULL because "any operand is NULL". > > <URL: http://dev.mysql.com/doc/mysql/en/Logical_Operators.html > > > With an unclear definition, it is perhaps not so strange that > behaviour will change with different versions of MySQL...? I suspect the reason "1 OR NULL" returns 1 in some versions is that the OR operator "short circuits", like in C. A "short circuit" operator is one that stops executing code as soon as the result is clear. In the case of OR, that means if you find one operand that's true, you don't have to check the other operands. (OR also short-circuits in Perl, which is why statements like 'do_something() or die("It didn't work!")' work as expected. If do_something() returns true, the die() is never executed.) What does the SQL standard say about this, if anything? I thought the result of any operation on NULL was supposed to return NULL, but I could be wrong. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]