forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit076f4d9
committed
pageinspect: Fix handling of page sizes and AM types
This commit fixes a set of issues related to the use of the SQLfunctions in this module when the caller is able to pass down raw pagedata as input argument:- The page size check was fuzzy in a couple of places, sometimeslooking after only a sub-range, but what we are looking for is an exactmatch on BLCKSZ. After considering a few options here, I have settleddown to do a generalization of get_page_from_raw(). Most of the SQLfunctions already used that, and this is not strictly required if notaccessing an 8-byte-wide value from a raw page, but this feels safer inthe long run for alignment-picky environment, particularly if a codepath begins to access such values. This also reduces the number ofstrings that need to be translated.- The BRIN function brin_page_items() uses a Relation but it did notcheck the access method of the opened index, potentially leading tocrashes. All the other functions in need of a Relation already didthat.- Some code paths could fail on elog(), but we should to use ereport()for failures that can be triggered by the user.Tests are added to stress all the cases that are fixed as of thiscommit, with some junk raw pages (\set VERBOSITY ensures that this worksacross all page sizes) and unexpected index types when functions openrelations.Author: Michael Paquier, Justin PrysbyDiscussion:https://postgr.es/m/20220218030020.GA1137@telsasoft.comBackpatch-through: 101 parent5e6368b commit076f4d9
File tree
18 files changed
+179
-67
lines changed- contrib/pageinspect
- expected
- sql
18 files changed
+179
-67
lines changedLines changed: 13 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
| |||
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| 35 | + | |
| 36 | + | |
34 | 37 |
| |
35 | 38 |
| |
36 | 39 |
| |
| |||
45 | 48 |
| |
46 | 49 |
| |
47 | 50 |
| |
48 |
| - | |
49 |
| - | |
| 51 | + | |
50 | 52 |
| |
51 | 53 |
| |
52 | 54 |
| |
53 | 55 |
| |
54 | 56 |
| |
55 | 57 |
| |
56 | 58 |
| |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
63 |
| - | |
64 |
| - | |
| 59 | + | |
65 | 60 |
| |
66 | 61 |
| |
67 | 62 |
| |
| |||
89 | 84 |
| |
90 | 85 |
| |
91 | 86 |
| |
92 |
| - | |
93 |
| - | |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
| 87 | + | |
105 | 88 |
| |
106 | 89 |
| |
107 | 90 |
| |
| |||
143 | 126 |
| |
144 | 127 |
| |
145 | 128 |
| |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
146 | 136 |
| |
147 | 137 |
| |
148 | 138 |
| |
|
Lines changed: 13 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
206 | 206 |
| |
207 | 207 |
| |
208 | 208 |
| |
209 |
| - | |
210 |
| - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
211 | 213 |
| |
212 | 214 |
| |
213 | 215 |
| |
| |||
476 | 478 |
| |
477 | 479 |
| |
478 | 480 |
| |
479 |
| - | |
480 |
| - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
481 | 485 |
| |
482 | 486 |
| |
483 | 487 |
| |
| |||
588 | 592 |
| |
589 | 593 |
| |
590 | 594 |
| |
591 |
| - | |
592 | 595 |
| |
593 | 596 |
| |
594 | 597 |
| |
| |||
601 | 604 |
| |
602 | 605 |
| |
603 | 606 |
| |
604 |
| - | |
605 |
| - | |
606 |
| - | |
607 |
| - | |
608 |
| - | |
609 |
| - | |
610 |
| - | |
611 | 607 |
| |
612 | 608 |
| |
613 | 609 |
| |
614 | 610 |
| |
615 | 611 |
| |
616 |
| - | |
| 612 | + | |
617 | 613 |
| |
618 | 614 |
| |
619 | 615 |
| |
| |||
698 | 694 |
| |
699 | 695 |
| |
700 | 696 |
| |
701 |
| - | |
702 |
| - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
703 | 701 |
| |
704 | 702 |
| |
705 | 703 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
48 | 48 |
| |
49 | 49 |
| |
50 | 50 |
| |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
51 | 55 |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
73 | 88 |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + |
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
64 | 64 |
| |
65 | 65 |
| |
66 | 66 |
| |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
67 | 82 |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
166 | 183 |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
207 | 207 |
| |
208 | 208 |
| |
209 | 209 |
| |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + |
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
39 | 40 |
| |
40 | 41 |
| |
41 | 42 |
| |
| |||
44 | 45 |
| |
45 | 46 |
| |
46 | 47 |
| |
47 |
| - | |
| 48 | + | |
| 49 | + | |
48 | 50 |
| |
49 | 51 |
| |
50 | 52 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
17 | 18 |
| |
18 | 19 |
| |
19 | 20 |
| |
| |||
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
| 32 | + | |
| 33 | + | |
31 | 34 |
| |
32 | 35 |
| |
33 | 36 |
| |
| |||
174 | 177 |
| |
175 | 178 |
| |
176 | 179 |
| |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
177 | 186 |
| |
178 | 187 |
| |
179 | 188 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
417 | 417 |
| |
418 | 418 |
| |
419 | 419 |
| |
420 |
| - | |
421 |
| - | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
422 | 424 |
| |
423 | 425 |
| |
424 | 426 |
| |
|
Lines changed: 3 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
249 |
| - | |
250 | 249 |
| |
251 | 250 |
| |
252 | 251 |
| |
| |||
263 | 262 |
| |
264 | 263 |
| |
265 | 264 |
| |
266 |
| - | |
267 |
| - | |
268 |
| - | |
269 |
| - | |
270 |
| - | |
271 |
| - | |
272 |
| - | |
273 |
| - | |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
| 265 | + | |
278 | 266 |
| |
279 | 267 |
| |
280 | 268 |
| |
| |||
350 | 338 |
| |
351 | 339 |
| |
352 | 340 |
| |
353 |
| - | |
354 |
| - | |
| 341 | + | |
355 | 342 |
| |
356 | 343 |
| |
357 | 344 |
| |
| |||
363 | 350 |
| |
364 | 351 |
| |
365 | 352 |
| |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 |
| - | |
374 |
| - | |
375 |
| - | |
376 |
| - | |
| 353 | + | |
377 | 354 |
| |
378 | 355 |
| |
379 | 356 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15 | 15 |
| |
16 | 16 |
| |
17 | 17 |
| |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
24 | 37 |
|
0 commit comments
Comments
(0)