diff options
author | Michael Paquier | 2023-12-19 09:19:05 +0000 |
---|---|---|
committer | Michael Paquier | 2023-12-19 09:19:05 +0000 |
commit | 20847013642127e75ee4fe3ddb8228a1fb4b652f (patch) | |
tree | 4f414f3406ab654adad534bbf948c1d9f9801afa /contrib/pageinspect/sql | |
parent | a8dd62ef4959141e410278fd68b3d1821e0bbbaa (diff) |
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
Diffstat (limited to 'contrib/pageinspect/sql')
-rw-r--r-- | contrib/pageinspect/sql/hash.sql | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/contrib/pageinspect/sql/hash.sql b/contrib/pageinspect/sql/hash.sql index 320fb9fa9f1..e4b9e975f8a 100644 --- a/contrib/pageinspect/sql/hash.sql +++ b/contrib/pageinspect/sql/hash.sql @@ -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; |