| PostgreSQL 8.2.3 Documentation | ||||
|---|---|---|---|---|
| Prev | Fast Backward | Chapter 8. Data Types | Fast Forward | Next |
PostgreSQL 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.
Valid literal values for the "true" state are:
| TRUE |
| 't' |
| 'true' |
| 'y' |
| 'yes' |
| '1' |
| FALSE |
| 'f' |
| 'false' |
| 'n' |
| 'no' |
| '0' |
Example 8-2. Using the boolean type
CREATE TABLE test1 (a boolean, b text); INSERT INTO test1 VALUES (TRUE, 'sic est'); INSERT INTO test1 VALUES (FALSE, 'non est'); SELECT * FROM test1; a | b ---+--------- t | sic est f | non est SELECT * FROM test1 WHERE a; a | b ---+--------- t | sic est
Example 8-2 shows that boolean values are output using the letters t and f.
boolean uses 1 byte of storage.
No comments could be found for this page.
Please use this form to add your own comments regarding your experience with particular features of PostgreSQL, clarifications of the documentation, or hints for other users. Please note, this is not a support forum, and your IP address will be logged. If you have a question or need help, please see the faq, try a mailing list, or join us on IRC. Note that submissions containing URLs or other keywords commonly found in 'spam' comments may be silently discarded. Please contact the webmaster if you think this is happening to you in error.
In order to submit a comment, you must have a community account.
* denotes required field