forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9221f9d
committed
Make contrib/btree_gist's GiST penalty function a bit saner.
The previous coding supposed that the first differing bytes in two varlenadatums must have the same sign difference as their overall comparisonresult. This is obviously bogus for text strings in non-C locales, andprobably wrong for numeric, and even for bytea I think it was wrong onmachines where char is signed. When the assumption failed, the functioncould deliver a zero or negative penalty in situations where such a resultis quite ridiculous, leading the core GiST code to make very bad page-splitdecisions.To fix, take the absolute values of the byte-level differences. Also,switch the code to using unsigned char not just char, so that the behaviorwill be consistent whether char is signed or not.Per investigation of a trouble report from Tomas Vondra. Back-patch to allsupported branches.1 parent94f565d commit9221f9d
1 file changed
+10
-14
lines changedLines changed: 10 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
108 | 108 |
| |
109 | 109 |
| |
110 | 110 |
| |
111 |
| - | |
112 | 111 |
| |
113 | 112 |
| |
114 | 113 |
| |
115 | 114 |
| |
116 | 115 |
| |
117 | 116 |
| |
118 |
| - | |
119 | 117 |
| |
120 | 118 |
| |
121 | 119 |
| |
| |||
126 | 124 |
| |
127 | 125 |
| |
128 | 126 |
| |
129 |
| - | |
130 | 127 |
| |
131 | 128 |
| |
132 | 129 |
| |
| |||
369 | 366 |
| |
370 | 367 |
| |
371 | 368 |
| |
372 |
| - | |
373 | 369 |
| |
374 | 370 |
| |
375 | 371 |
| |
376 | 372 |
| |
377 | 373 |
| |
378 | 374 |
| |
| 375 | + | |
| 376 | + | |
379 | 377 |
| |
380 | 378 |
| |
381 | 379 |
| |
| |||
390 | 388 |
| |
391 | 389 |
| |
392 | 390 |
| |
393 |
| - | |
| 391 | + | |
394 | 392 |
| |
395 | 393 |
| |
396 | 394 |
| |
| |||
401 | 399 |
| |
402 | 400 |
| |
403 | 401 |
| |
404 |
| - | |
| 402 | + | |
405 | 403 |
| |
406 | 404 |
| |
407 | 405 |
| |
408 | 406 |
| |
| 407 | + | |
409 | 408 |
| |
410 |
| - | |
411 |
| - | |
412 |
| - | |
413 |
| - | |
414 |
| - | |
415 |
| - | |
416 |
| - | |
417 |
| - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
418 | 414 |
| |
419 | 415 |
| |
420 | 416 |
| |
|
0 commit comments
Comments
(0)