mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pageinspect: Fix failure with hash_bitmap_info() for partitioned indexes
This function reads directly a page from a relation, relying on index_open() to open the index to read from. Unfortunately, this would crash when using partitioned indexes, as these can be opened with index_open() but they have no physical pages. Alexander has fixed the module, while I have written the test. Author: Alexander Lakhin, Michael Paquier Discussion: https://postgr.es/m/18246-f4d9ff7cb3af77e6@postgresql.org Backpatch-through: 12
This commit is contained in:
@ -2,6 +2,9 @@ CREATE TABLE test_hash (a int, b text);
|
||||
INSERT INTO test_hash VALUES (1, 'one');
|
||||
CREATE INDEX test_hash_a_idx ON test_hash USING hash (a);
|
||||
|
||||
CREATE TABLE test_hash_part (a int, b int) PARTITION BY RANGE (a);
|
||||
CREATE INDEX test_hash_part_idx ON test_hash_part USING hash(b);
|
||||
|
||||
\x
|
||||
|
||||
SELECT hash_page_type(get_raw_page('test_hash_a_idx', 0));
|
||||
@ -21,6 +24,7 @@ SELECT * FROM hash_bitmap_info('test_hash_a_idx', 3);
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 4);
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 5);
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 6);
|
||||
SELECT * FROM hash_bitmap_info('test_hash_part_idx', 1); -- error
|
||||
|
||||
|
||||
SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
|
||||
@ -106,3 +110,4 @@ SELECT hash_page_stats(decode(repeat('00', :block_size), 'hex'));
|
||||
SELECT hash_page_type(decode(repeat('00', :block_size), 'hex'));
|
||||
|
||||
DROP TABLE test_hash;
|
||||
DROP TABLE test_hash_part;
|
||||
|
Reference in New Issue
Block a user