SQLite Forum

Bug when converting string to boolean?
Login
First, for the documentation, it doesn't explicitly state the string should start with a number. It only gives the example which starts with a number. I think it could be adjusted to state the string must start with a number to be evaluated to true.

Secondly, it doesn't explain why `'1english'` is neither a FASLE or a TRUE. It is neither a NULL. I expected it should implicitly convert the string to a number/Boolean when I compare it to a number/Boolean. 

Intuitively, when comparing with `=`, the engine should do the conversion itself.

If I do `select '1xxx'=TRUE;`, it is intuitively expected to convert the left hand side to a bool. Vice versa, it could also convert the right hand side to a string and compare. In the case of my examples, if it is meaningless to compare a string with a Boolean, it should raise a warning or forbid the user from using the comparison, which leads to never true result. Similarly, what is the meaning of `=` in `'1xxx'=TRUE` is not explained. 

If it is not comparing the value, is it comparing the type? But because the result is always false, I couldn't tell whether I get a correct result.