SQLite Forum

Bug when converting string to boolean?
Login
Hi all,



Consider the following query:

````
sqlite> select null or (null or 'xxx1');
````


According to the [doc](https://www.sqlite.org/lang_expr.html
):

> For example, the values NULL, 0.0, 0, 'english' and '0' are all considered to > be false. Values 1, 1.0, 0.1, -0.1 and '1english' are considered to be true. 



For this case, `'xxx1'` should be evaluated to `1` or `True`, and the whole query should return `1`.


However, it returned the following:


``
sqlite> select null or (null or 'xxx1');
<NULL>
``

Similarly, we have:

``
sqlite> select 'xxx1' is 1;
0
``

Furthermore, I got:

````
sqlite> select '1english' is 1;
0

-- implicit conversion?
sqlite> select '1english' or null;
1

sqlite> select '1english' != 1;
1

sqlite> select '1english' = FALSE;
0

sqlite> select '1english' = TRUE;
0

sqlite>  select '1english' != TRUE;
1

-- ? what is it except for true and false?
sqlite>  select '1english' != FALSE;
1

-- correct
sqlite> select '1english' is TRUE;
1

-- correct
sqlite> select '1english' is FALSE;
0
````

This is inconsistent with the documentation.