Boolean types v16
Name | Native | Alias | Description |
---|---|---|---|
BOOLEAN | ✅ | Logical Boolean (true/false), 1 byte storage. |
Overview
EDB Postgres Advanced Server provides the standard SQL type BOOLEAN
. BOOLEAN
can have one of only two states: TRUE
or FALSE
. A third state, UNKNOWN
, is represented by the SQL NULL
value.
Literal values representing the TRUE
state include 'TRUE', 'true', 'y', '1' and 't'. Literal values representing FALSE
include 'FALSE', 'false', 'n', '0' and 'f'. There is no literal value for UNKNOWN
; use NULL
.
The follow is an example using the boolean type:
Note that the parser automatically understands that TRUE
and FALSE
are of type boolean, but this is not so for NULL
because that can have any type. So in some contexts you might have to cast NULL
to BOOLEAN
explicitly.
- On this page
- Overview