diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/create_index.out | 42 | ||||
-rw-r--r-- | src/test/regress/sql/create_index.sql | 15 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out index e663f9a3d08..c6dfb26dd55 100644 --- a/src/test/regress/expected/create_index.out +++ b/src/test/regress/expected/create_index.out @@ -2953,6 +2953,48 @@ explain (costs off) (2 rows) -- +-- Check matching of boolean index columns to WHERE conditions and sort keys +-- +create temp table boolindex (b bool, i int, unique(b, i), junk float); +explain (costs off) + select * from boolindex order by b, i limit 10; + QUERY PLAN +------------------------------------------------------- + Limit + -> Index Scan using boolindex_b_i_key on boolindex +(2 rows) + +explain (costs off) + select * from boolindex where b order by i limit 10; + QUERY PLAN +------------------------------------------------------- + Limit + -> Index Scan using boolindex_b_i_key on boolindex + Index Cond: (b = true) + Filter: b +(4 rows) + +explain (costs off) + select * from boolindex where b = true order by i desc limit 10; + QUERY PLAN +---------------------------------------------------------------- + Limit + -> Index Scan Backward using boolindex_b_i_key on boolindex + Index Cond: (b = true) + Filter: b +(4 rows) + +explain (costs off) + select * from boolindex where not b order by i limit 10; + QUERY PLAN +------------------------------------------------------- + Limit + -> Index Scan using boolindex_b_i_key on boolindex + Index Cond: (b = false) + Filter: (NOT b) +(4 rows) + +-- -- REINDEX (VERBOSE) -- CREATE TABLE reindex_verbose(id integer primary key); diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql index 71f4f54cada..822c34af237 100644 --- a/src/test/regress/sql/create_index.sql +++ b/src/test/regress/sql/create_index.sql @@ -1011,6 +1011,21 @@ explain (costs off) select * from tenk1 where (thousand, tenthous) in ((1,1001), (null,null)); -- +-- Check matching of boolean index columns to WHERE conditions and sort keys +-- + +create temp table boolindex (b bool, i int, unique(b, i), junk float); + +explain (costs off) + select * from boolindex order by b, i limit 10; +explain (costs off) + select * from boolindex where b order by i limit 10; +explain (costs off) + select * from boolindex where b = true order by i desc limit 10; +explain (costs off) + select * from boolindex where not b order by i limit 10; + +-- -- REINDEX (VERBOSE) -- CREATE TABLE reindex_verbose(id integer primary key); |