Actually I've found the solution. When working with booleans, the query result is of type "number". That allows you to discriminate between existing values and NULL values. For example, if you query for a boolean column and you get a result of type boolean and of value false, that means the column doesn't have a value. If on the other hand, you receive a result of type number and value 1/0 then you can cast to boolean and the thing is done.