forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7da5159
committed
Fix incorrect presorted DISTINCT aggregate if condition
Here we fix a faulty "if" condition which failed to correctly handle twoor more consecutive NULL transition values when checking if the new valueis DISTINCT from the old value for presorted aggregates. Given a suitablynon-strict aggregate transition function, a byref aggregate could cause acrash due to calling the type's equality function and passing along a(Datum) 0 value to test for equality, the equality function would then tryto dereference that 0 Datum and segfault. For byval types, there'd havebeen no crash and the equality function would have seen that the two 0Datums matched, which (only by chance) meant the calling code would haveworked correctly.Here we ensure that we only call the equality function when neither ofthe input values are NULL.This code is all new as of1349d27, so no backpatch needed.Reported-by: Fujii MasaoDiscussion:https://postgr.es/m/860c6d6f-a3c5-3ae9-9da2-827177bede06@oss.nttdata.com1 parent836c31b commit7da5159
File tree
3 files changed
+15
-3
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+15
-3
lines changedLines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4250 | 4250 |
| |
4251 | 4251 |
| |
4252 | 4252 |
| |
4253 |
| - | |
4254 |
| - | |
4255 |
| - | |
| 4253 | + | |
| 4254 | + | |
| 4255 | + | |
4256 | 4256 |
| |
4257 | 4257 |
| |
4258 | 4258 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1506 | 1506 |
| |
1507 | 1507 |
| |
1508 | 1508 |
| |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
1509 | 1517 |
| |
1510 | 1518 |
| |
1511 | 1519 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
567 | 567 |
| |
568 | 568 |
| |
569 | 569 |
| |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
570 | 574 |
| |
571 | 575 |
| |
572 | 576 |
| |
|
0 commit comments
Comments
(0)