Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 606ccc5

Browse files
committed
Improve test case exercising the sorting path for hash index build.
On second thought, we should probably do at least a minimal check that the constructed index is valid, since the big problem with the most recent breakage was not whether the sorting was correct but that the index had incorrect hash codes placed in it.
1 parent 9563d5b commit 606ccc5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/test/regress/expected/create_index.out

+17
Original file line numberDiff line numberDiff line change
@@ -2351,6 +2351,23 @@ DROP TABLE unlogged_hash_table;
23512351
SET maintenance_work_mem = '1MB';
23522352
CREATE INDEX hash_tuplesort_idx ON tenk1 USING hash (stringu1 name_ops) WITH (fillfactor = 10);
23532353
WARNING: hash indexes are not WAL-logged and their use is discouraged
2354+
EXPLAIN (COSTS OFF)
2355+
SELECT count(*) FROM tenk1 WHERE stringu1 = 'TVAAAA';
2356+
QUERY PLAN
2357+
-------------------------------------------------------
2358+
Aggregate
2359+
-> Bitmap Heap Scan on tenk1
2360+
Recheck Cond: (stringu1 = 'TVAAAA'::name)
2361+
-> Bitmap Index Scan on hash_tuplesort_idx
2362+
Index Cond: (stringu1 = 'TVAAAA'::name)
2363+
(5 rows)
2364+
2365+
SELECT count(*) FROM tenk1 WHERE stringu1 = 'TVAAAA';
2366+
count
2367+
-------
2368+
14
2369+
(1 row)
2370+
23542371
DROP INDEX hash_tuplesort_idx;
23552372
RESET maintenance_work_mem;
23562373
--

src/test/regress/sql/create_index.sql

+3
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,9 @@ DROP TABLE unlogged_hash_table;
694694
-- maintenance_work_mem setting and fillfactor:
695695
SET maintenance_work_mem = '1MB';
696696
CREATE INDEX hash_tuplesort_idx ON tenk1 USING hash (stringu1 name_ops) WITH (fillfactor = 10);
697+
EXPLAIN (COSTS OFF)
698+
SELECT count(*) FROM tenk1 WHERE stringu1 = 'TVAAAA';
699+
SELECT count(*) FROM tenk1 WHERE stringu1 = 'TVAAAA';
697700
DROP INDEX hash_tuplesort_idx;
698701
RESET maintenance_work_mem;
699702

0 commit comments

Comments
 (0)