Difference between Bit and Boolean datatypes in PostgreSQL
A bit
only stores the numbers 0
and 1
(or null
).
A boolean
only stores true
and false
(or null
). A number (0, 1) is not a boolean. A boolean value can be used anywhere a boolean expression is expected. So you can e.g. do this:
where is_active
A bit column needs to be compared to something:
where a_bit_column = 0
(the result of a_bit_column = 0
is a boolean)
Contrary to the what some DBMS think, the expression where 0
or where 1
is not valid boolean expression.