Debian Codegraph @

contrib/pageinspect/expected/hash.out

raw
1 CREATE TABLE test_hash (a int, b text);
2 INSERT INTO test_hash VALUES (1, 'one');
3 CREATE INDEX test_hash_a_idx ON test_hash USING hash (a);
4 CREATE TABLE test_hash_part (a int, b int) PARTITION BY RANGE (a);
5 CREATE INDEX test_hash_part_idx ON test_hash_part USING hash(b);
6 \x
7 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 0));
8 -[ RECORD 1 ]--+---------
9 hash_page_type | metapage
10
11 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 1));
12 -[ RECORD 1 ]--+-------
13 hash_page_type | bucket
14
15 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 2));
16 -[ RECORD 1 ]--+-------
17 hash_page_type | bucket
18
19 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 3));
20 -[ RECORD 1 ]--+-------
21 hash_page_type | bucket
22
23 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 4));
24 -[ RECORD 1 ]--+-------
25 hash_page_type | bucket
26
27 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 5));
28 -[ RECORD 1 ]--+-------
29 hash_page_type | bitmap
30
31 SELECT hash_page_type(get_raw_page('test_hash_a_idx', 6));
32 ERROR: block number 6 is out of range for relation "test_hash_a_idx"
33 SELECT * FROM hash_bitmap_info('test_hash_a_idx', -1);
34 ERROR: invalid block number
35 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 0);
36 ERROR: invalid overflow block number 0
37 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 1);
38 ERROR: invalid overflow block number 1
39 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 2);
40 ERROR: invalid overflow block number 2
41 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 3);
42 ERROR: invalid overflow block number 3
43 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 4);
44 ERROR: invalid overflow block number 4
45 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 5);
46 ERROR: invalid overflow block number 5
47 SELECT * FROM hash_bitmap_info('test_hash_a_idx', 6);
48 ERROR: block number 6 is out of range for relation "test_hash_a_idx"
49 SELECT * FROM hash_bitmap_info('test_hash_part_idx', 1); -- error
50 ERROR: "test_hash_part_idx" is not a hash index
51 SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
52 lowmask, ovflpoint, firstfree, nmaps, procid, spares, mapp FROM
53 hash_metapage_info(get_raw_page('test_hash_a_idx', 0));
54 -[ RECORD 1 ]--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
55 magic | 105121344
56 version | 4
57 ntuples | 1
58 bsize | 8152
59 bmsize | 4096
60 bmshift | 15
61 maxbucket | 3
62 highmask | 7
63 lowmask | 3
64 ovflpoint | 2
65 firstfree | 0
66 nmaps | 1
67 procid | 450
68 spares | {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
69 mapp | {5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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raw_page('test_hash_a_idx', 1));
74 ERROR: page is not a hash meta page
75 SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
76 lowmask, ovflpoint, firstfree, nmaps, procid, spares, mapp FROM
77 hash_metapage_info(get_raw_page('test_hash_a_idx', 2));
78 ERROR: page is not a hash meta page
79 SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
80 lowmask, ovflpoint, firstfree, nmaps, procid, spares, mapp FROM
81 hash_metapage_info(get_raw_page('test_hash_a_idx', 3));
82 ERROR: page is not a hash meta page
83 SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
84 lowmask, ovflpoint, firstfree, nmaps, procid, spares, mapp FROM
85 hash_metapage_info(get_raw_page('test_hash_a_idx', 4));
86 ERROR: page is not a hash meta page
87 SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
88 lowmask, ovflpoint, firstfree, nmaps, procid, spares, mapp FROM
89 hash_metapage_info(get_raw_page('test_hash_a_idx', 5));
90 ERROR: page is not a hash meta page
91 SELECT live_items, dead_items, page_size, hasho_prevblkno, hasho_nextblkno,
92 hasho_bucket, hasho_flag, hasho_page_id FROM
93 hash_page_stats(get_raw_page('test_hash_a_idx', 0));
94 ERROR: page is not a hash bucket or overflow page
95 SELECT live_items, dead_items, page_size, hasho_prevblkno, hasho_nextblkno,
96 hasho_bucket, hasho_flag, hasho_page_id FROM
97 hash_page_stats(get_raw_page('test_hash_a_idx', 1));
98 -[ RECORD 1 ]---+-----------
99 live_items | 0
100 dead_items | 0
101 page_size | 8192
102 hasho_prevblkno | 3
103 hasho_nextblkno | 4294967295
104 hasho_bucket | 0
105 hasho_flag | 2
106 hasho_page_id | 65408
107
108 SELECT live_items, dead_items, page_size, hasho_prevblkno, hasho_nextblkno,
109 hasho_bucket, hasho_flag, hasho_page_id FROM
110 hash_page_stats(get_raw_page('test_hash_a_idx', 2));
111 -[ RECORD 1 ]---+-----------
112 live_items | 0
113 dead_items | 0
114 page_size | 8192
115 hasho_prevblkno | 3
116 hasho_nextblkno | 4294967295
117 hasho_bucket | 1
118 hasho_flag | 2
119 hasho_page_id | 65408
120
121 SELECT live_items, dead_items, page_size, hasho_prevblkno, hasho_nextblkno,
122 hasho_bucket, hasho_flag, hasho_page_id FROM
123 hash_page_stats(get_raw_page('test_hash_a_idx', 3));
124 -[ RECORD 1 ]---+-----------
125 live_items | 1
126 dead_items | 0
127 page_size | 8192
128 hasho_prevblkno | 3
129 hasho_nextblkno | 4294967295
130 hasho_bucket | 2
131 hasho_flag | 2
132 hasho_page_id | 65408
133
134 SELECT live_items, dead_items, page_size, hasho_prevblkno, hasho_nextblkno,
135 hasho_bucket, hasho_flag, hasho_page_id FROM
136 hash_page_stats(get_raw_page('test_hash_a_idx', 4));
137 -[ RECORD 1 ]---+-----------
138 live_items | 0
139 dead_items | 0
140 page_size | 8192
141 hasho_prevblkno | 3
142 hasho_nextblkno | 4294967295
143 hasho_bucket | 3
144 hasho_flag | 2
145 hasho_page_id | 65408
146
147 SELECT live_items, dead_items, page_size, hasho_prevblkno, hasho_nextblkno,
148 hasho_bucket, hasho_flag, hasho_page_id FROM
149 hash_page_stats(get_raw_page('test_hash_a_idx', 5));
150 ERROR: page is not a hash bucket or overflow page
151 SELECT * FROM hash_page_items(get_raw_page('test_hash_a_idx', 0));
152 ERROR: page is not a hash bucket or overflow page
153 SELECT * FROM hash_page_items(get_raw_page('test_hash_a_idx', 1));
154 (0 rows)
155
156 SELECT * FROM hash_page_items(get_raw_page('test_hash_a_idx', 2));
157 (0 rows)
158
159 SELECT * FROM hash_page_items(get_raw_page('test_hash_a_idx', 3));
160 -[ RECORD 1 ]----------
161 itemoffset | 1
162 ctid | (0,1)
163 data | 2389907270
164
165 SELECT * FROM hash_page_items(get_raw_page('test_hash_a_idx', 4));
166 (0 rows)
167
168 SELECT * FROM hash_page_items(get_raw_page('test_hash_a_idx', 5));
169 ERROR: page is not a hash bucket or overflow page
170 -- Failure with non-hash index
171 CREATE INDEX test_hash_a_btree ON test_hash USING btree (a);
172 SELECT hash_bitmap_info('test_hash_a_btree', 0);
173 ERROR: "test_hash_a_btree" is not a hash index
174 -- Failure with various modes.
175 -- Suppress the DETAIL message, to allow the tests to work across various
176 -- page sizes and architectures.
177 \set VERBOSITY terse
178 -- invalid page size
179 SELECT hash_metapage_info('aaa'::bytea);
180 ERROR: invalid page size
181 SELECT hash_page_items('bbb'::bytea);
182 ERROR: invalid page size
183 SELECT hash_page_stats('ccc'::bytea);
184 ERROR: invalid page size
185 SELECT hash_page_type('ddd'::bytea);
186 ERROR: invalid page size
187 -- invalid special area size
188 SELECT hash_metapage_info(get_raw_page('test_hash', 0));
189 ERROR: input page is not a valid hash page
190 SELECT hash_page_items(get_raw_page('test_hash', 0));
191 ERROR: input page is not a valid hash page
192 SELECT hash_page_stats(get_raw_page('test_hash', 0));
193 ERROR: input page is not a valid hash page
194 SELECT hash_page_type(get_raw_page('test_hash', 0));
195 ERROR: input page is not a valid hash page
196 \set VERBOSITY default
197 -- Tests with all-zero pages.
198 SHOW block_size \gset
199 SELECT hash_metapage_info(decode(repeat('00', :block_size), 'hex'));
200 ERROR: page is not a hash meta page
201 SELECT hash_page_items(decode(repeat('00', :block_size), 'hex'));
202 ERROR: page is not a hash bucket or overflow page
203 SELECT hash_page_stats(decode(repeat('00', :block_size), 'hex'));
204 ERROR: page is not a hash bucket or overflow page
205 SELECT hash_page_type(decode(repeat('00', :block_size), 'hex'));
206 -[ RECORD 1 ]--+-------
207 hash_page_type | unused
208
209 DROP TABLE test_hash;
210 DROP TABLE test_hash_part;