forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitdfc843d
committed
Fix more confusion in SP-GiST.
spg_box_quad_leaf_consistent unconditionally returned the leafdatum as leafValue, even though in its usage for poly_ops thatvalue is of completely the wrong type.In versions before 12, that was harmless because the core code didnothing with leafValue in non-index-only scans ... but since commit2a63683, if we were doing a KNN-style scan, spgNewHeapItem wouldunconditionally try to copy the value using the wrong datatypeparameters. Said copying is a waste of time and space if we're notgoing to return the data, but it accidentally failed to fail untilI fixed the datatype confusion inac9099f.Hence, change spgNewHeapItem to not copy the datum unless we'reactually going to return it later. This saves cycles and dodgesthe question of whether lossy opclasses are returning the righttype. Also change spg_box_quad_leaf_consistent to not returndata that might be of the wrong type, as insurance againstsomebody introducing a similar bug into the core code in future.It seems like a good idea to back-patch these two changes intov12 and v13, although I'm afraid to change spgNewHeapItem'smistaken idea of which datatype to use in those branches.Per buildfarm results fromac9099f.Discussion:https://postgr.es/m/3728741.1617381471@sss.pgh.pa.us1 parentac9099f commitdfc843d
2 files changed
+20
-7
lines changedLines changed: 13 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
463 | 463 |
| |
464 | 464 |
| |
465 | 465 |
| |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
471 | 479 |
| |
472 | 480 |
| |
473 | 481 |
| |
|
Lines changed: 7 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
749 | 749 |
| |
750 | 750 |
| |
751 | 751 |
| |
752 |
| - | |
753 |
| - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
754 | 759 |
| |
755 | 760 |
| |
756 | 761 |
| |
|
0 commit comments
Comments
(0)