BOOLEAN data type
The BOOLEAN data type stores TRUE or FALSE data values as a single byte.
The following table shows internal and literal representations
of the BOOLEAN data type.
Logical Value | Internal Representation | Literal Representation |
---|---|---|
TRUE | \0 | 't' |
FALSE | \1 | 'f' |
NULL | Internal Use Only | NULL |
You can compare two BOOLEAN values to test for equality or inequality. You can also compare a BOOLEAN value to the Boolean literals 't' and 'f'. BOOLEAN values are not case-sensitive; 't' is equivalent to 'T' and 'f' to 'F'.
You can use a BOOLEAN column to store what a Boolean expression
returns. In the following example, the value of boolean_column is
't' if column1 is less than column2,
'f' if column1 is greater than or equal to column2,
and NULL if the value of either column1 or column2 is
unknown:
UPDATE my_table SET boolean_column = lessthan(column1, column2)