summaryrefslogtreecommitdiffstats
path: root/contrib/btree_gin/sql/bool.sql
blob: dad2ff32b825538195aeb5f2e3ca1563dfb621a2 (plain)
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
set enable_seqscan=off;

CREATE TABLE test_bool (
	i boolean
);

INSERT INTO test_bool VALUES (false),(true),(null);

CREATE INDEX idx_bool ON test_bool USING gin (i);

SELECT * FROM test_bool WHERE i<true ORDER BY i;
SELECT * FROM test_bool WHERE i<=true ORDER BY i;
SELECT * FROM test_bool WHERE i=true ORDER BY i;
SELECT * FROM test_bool WHERE i>=true ORDER BY i;
SELECT * FROM test_bool WHERE i>true ORDER BY i;

SELECT * FROM test_bool WHERE i<false ORDER BY i;
SELECT * FROM test_bool WHERE i<=false ORDER BY i;
SELECT * FROM test_bool WHERE i=false ORDER BY i;
SELECT * FROM test_bool WHERE i>=false ORDER BY i;
SELECT * FROM test_bool WHERE i>false ORDER BY i;

EXPLAIN (COSTS OFF) SELECT * FROM test_bool WHERE i<true ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_bool WHERE i<=true ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_bool WHERE i=true ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_bool WHERE i>=true ORDER BY i;
EXPLAIN (COSTS OFF) SELECT * FROM test_bool WHERE i>true ORDER BY i;