forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite4deae7
committed
Fix handling of NULLs in MCV items and constants
There were two issues in how the extended statistics handled NULL valuesin opclauses. Firstly, the code was oblivious to the possibility thatConst may be NULL (constisnull=true) in which case the constvalue isundefined. We need to treat this as a mismatch, and not call the proc.Secondly, the MCV item itself may contain NULL values too - the codealready did check that, and updated the match bitmap accordingly, butfailed to ensure we won't call the operator procedure anyway. It didwork for AND-clauses, because in that case false in the bitmap stopsevaluation of further clauses. But for OR-clauses ir was not easy toget incorrect estimates or even trigger a crash.This fixes both issues by extending the existing check so that it looksat constisnull too, and making sure it skips calling the procedure.Discussion:https://postgr.es/m/8736jdhbhc.fsf%40ansel.ydns.eu1 parente8b6ae2 commite4deae7
File tree
3 files changed
+60
-5
lines changed- src
- backend/statistics
- test/regress
- expected
- sql
3 files changed
+60
-5
lines changedLines changed: 11 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1593 | 1593 |
| |
1594 | 1594 |
| |
1595 | 1595 |
| |
1596 |
| - | |
1597 |
| - | |
1598 |
| - | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
1599 | 1599 |
| |
1600 |
| - | |
1601 |
| - | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
1602 | 1608 |
| |
1603 | 1609 |
| |
1604 | 1610 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
619 | 619 |
| |
620 | 620 |
| |
621 | 621 |
| |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
622 | 648 |
| |
623 | 649 |
| |
624 | 650 |
| |
|
Lines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
393 | 393 |
| |
394 | 394 |
| |
395 | 395 |
| |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
396 | 419 |
| |
397 | 420 |
| |
398 | 421 |
| |
|
0 commit comments
Comments
(0)