forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite7bff46
committed
pageinspect: Fix gist_page_items() with included columns
Non-leaf pages of GiST indexes contain key attributes, leaf pagescontain both key and non-key attributes, and gist_page_items() ignoredthe handling of non-key attributes. This caused a few problems whenusing gist_page_items() on a GiST index with INCLUDE:- On a non-leaf page, the function would crash.- On a leaf page, the function would work, but miss to display all thevalues for included attributes.This commit fixes gist_page_items() to handle such cases in a moreappropriate way, and now displays the values of key and non-keyattributes for each item separately in a style consistent with whatruleutils.c would generate for the attribute list, depending on the pagetype dealt with. In a way similar to how a record is displayed, valueswould be double-quoted for key or non-key attributes if required.ruleutils.c did not provide a routine able to control if non-keyattributes should be displayed, so an extended() routine for indexdefinitions is added to work around the leaf and non-leaf pagedifferences.While on it, this commit fixes a third problem related to the amount ofdata reported for key attributes. The code originally relied onBuildIndexValueDescription() (used for error reports on constraints)that would not print all the data stored in the index but the indexopclass's input type, so this limited the amount of informationavailable. This switch makes gist_page_items() much cheaper as there isno need to run ACL checks for each item printed, which is not an issueanyway as superuser rights are required to execute the functions ofpageinspect. Opclasses whose data cannot be displayed can rely ongist_page_items_bytea().The documentation of this function was slightly incorrect for theoutput results generated on HEAD and v15, so adjust it on thesebranches.Author: Alexander Lakhin, Michael PaquierDiscussion:https://postgr.es/m/17884-cb8c326522977acb@postgresql.orgBackpatch-through: 141 parent613a7ec commite7bff46
File tree
6 files changed
+178
-31
lines changed- contrib/pageinspect
- expected
- sql
- doc/src/sgml
- src
- backend/utils/adt
- include/utils
6 files changed
+178
-31
lines changedLines changed: 38 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 |
| - | |
39 |
| - | |
40 |
| - | |
41 |
| - | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
45 |
| - | |
46 |
| - | |
47 |
| - | |
48 |
| - | |
49 |
| - | |
50 |
| - | |
51 |
| - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| |||
107 | 107 |
| |
108 | 108 |
| |
109 | 109 |
| |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
110 | 133 |
|
Lines changed: 96 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
25 | 24 |
| |
| 25 | + | |
| 26 | + | |
| 27 | + | |
26 | 28 |
| |
27 | 29 |
| |
28 | 30 |
| |
| |||
198 | 200 |
| |
199 | 201 |
| |
200 | 202 |
| |
| 203 | + | |
201 | 204 |
| |
| 205 | + | |
| 206 | + | |
202 | 207 |
| |
203 | 208 |
| |
| 209 | + | |
204 | 210 |
| |
205 | 211 |
| |
206 | 212 |
| |
| |||
226 | 232 |
| |
227 | 233 |
| |
228 | 234 |
| |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
229 | 256 |
| |
230 | 257 |
| |
231 | 258 |
| |
| |||
242 | 269 |
| |
243 | 270 |
| |
244 | 271 |
| |
245 |
| - | |
| 272 | + | |
| 273 | + | |
246 | 274 |
| |
247 | 275 |
| |
248 | 276 |
| |
| |||
251 | 279 |
| |
252 | 280 |
| |
253 | 281 |
| |
254 |
| - | |
| 282 | + | |
255 | 283 |
| |
256 | 284 |
| |
257 | 285 |
| |
| |||
261 | 289 |
| |
262 | 290 |
| |
263 | 291 |
| |
264 |
| - | |
265 |
| - | |
266 |
| - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
267 | 357 |
| |
268 | 358 |
| |
269 | 359 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
55 | 69 |
|
Lines changed: 9 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
764 | 764 |
| |
765 | 765 |
| |
766 | 766 |
| |
767 |
| - | |
768 |
| - | |
769 |
| - | |
770 |
| - | |
771 |
| - | |
772 |
| - | |
773 |
| - | |
774 |
| - | |
775 |
| - | |
776 |
| - | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
777 | 776 |
| |
778 | 777 |
| |
779 | 778 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1215 | 1215 |
| |
1216 | 1216 |
| |
1217 | 1217 |
| |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1218 | 1234 |
| |
1219 | 1235 |
| |
1220 | 1236 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 |
| |
24 | 27 |
| |
25 | 28 |
| |
| 29 | + | |
| 30 | + | |
26 | 31 |
| |
27 | 32 |
| |
28 | 33 |
| |
|
0 commit comments
Comments
(0)