Updated on 2025-08-25 GMT+08:00

Boolean Type

Table 1 Boolean type

Type

Description

Storage Space

Value

BOOLEAN

Boolean type

1 byte.

  • true: true
  • false: false
  • null: unknown

Valid text values for true:

TRUE, 't', 'true', 'y', 'yes', '1'.

Valid text values for false:

FALSE, 'f', 'false', 'n', 'no', '0'.

Using TRUE and FALSE is more standardized (and SQL-compliant).

Example

Display Boolean values with the letters t and f.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Create a table.
CREATE TABLE bool_type_t1
(
BT_COL1 BOOLEAN,
BT_COL2 TEXT
) STORE AS orc;

-- Insert data.
INSERT INTO bool_type_t1 VALUES (TRUE, 'sic est');
INSERT INTO bool_type_t1 VALUES (FALSE, 'non est');

-- View data.
SELECT * FROM bool_type_t1;
 bt_col1 | bt_col2 
---------+---------
 t       | sic est
 f       | non est
(2 rows)

SELECT * FROM bool_type_t1 WHERE bt_col1 = 't';
 bl_col1 | bt_col2 
---------+---------
 t       | sic est
(1 row)

-- Drop the table.
DROP TABLE bool_type_t1;