Postgres supports bool as the SQL3 boolean type. bool can have one of only two states: 'true' or 'false'. A third state, 'unknown', is not implemented and is not suggested in SQL3; NULL is an effective substitute. bool can be used in any boolean expression, and boolean expressions always evaluate to a result compatible with this type.
Postgres は、SQL3 の boolean 型に相当する、bool 型をサポートして います。 bool 型は、'true (真)'、或いは、'false (偽)'という 2つのステータスしか持つことができません。 boolean 型の 3 番目の状態である 'unknown (不明)' は実装されて いませんが、これはSQL3でも提案されません。 ただ、NULL がこれの効果的な代案になります。 bool 型は、あらゆる真偽表現と、常に判定結果がこの データ型と互換性のある真偽式で使うことができます。
bool uses 1 byte of storage.
bool 型は、記憶領域に 1byte 使用します。
Table 3-17. Postgres ブール値型
状態 | 出力値 | 入力値 |
---|---|---|
真 | 't' | TRUE, 't', 'true', 'y', 'yes', '1' |
偽 | 'f' | FALSE, 'f', 'false', 'n', 'no', '0' |