| PostgreSQL 9.4.1 Documentation | |||
|---|---|---|---|
| Prev | Up | Chapter 8. Data Types | Next |
8.6. Boolean Type
PostgreSQL provides the standardSQL typeboolean; seeTable 8-19. Theboolean type can have several states:"true","false", and a third state,"unknown", which is represented by theSQL 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 wordsTRUE andFALSE are the preferred (SQL-compliant) usage. Example 8-2 shows thatboolean values are output using the letterst andf.