Boolean Type
| PostgreSQL 9.3.25 Documentation | ||||
|---|---|---|---|---|
| Prev | Up | Chapter 8. Data Types | Next | |
PostgreSQL provides the standard SQL type boolean ; see Table 8-19 . The boolean type can have several states: "true" , "false" , and a third state, "unknown" , which is represented by the SQL null value.
Valid literal values for the "true" state are:
| TRUE | 
| 't' | 
| 'true' | 
| 'y' | 
| 'yes' | 
| 'on' | 
| '1' | 
For the "false" state, the following values can be used:
| FALSE | 
| 'f' | 
| 'false' | 
| 'n' | 
| 'no' | 
| 'off' | 
| '0' | 
Leading or trailing whitespace is ignored, and case does not matter. The key words TRUE and FALSE are the preferred ( SQL -compliant) usage.
Example 8-2 shows that boolean values are output using the letters t and f .