forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2072932
committed
Suppress unnecessary RelabelType nodes in yet more cases.
Commita477bfc fixed eval_const_expressions() to ensure that itdidn't generate unnecessary RelabelType nodes, but I failed to noticethat some other places in the planner had the same issue. Reallynoplace in the planner should be using plain makeRelabelType(), forfear of generating expressions that should be equal() to semanticallyequivalent trees, but aren't.An example is that because canonicalize_ec_expression() failedto be careful about this, we could end up with an equivalence classcontaining both a plain Const, and a Const-with-RelabelTyperepresenting exactly the same value. So far as I can tell this led tono visible misbehavior, but we did waste a bunch of cycles generatingand evaluating "Const = Const-with-RelabelType" to prove such entriesare redundant.Hence, move the support function added bya477bfc to where it canbe more generally useful, and use it in the places where planner codepreviously used makeRelabelType.Back-patch to v12, like the previous patch. While I have no concreteevidence of any real misbehavior here, it's certainly possible thatI overlooked a case where equivalent expressions that aren't equal()could cause a user-visible problem. In any case carrying extraRelabelType nodes through planning to execution isn't very desirable.Discussion:https://postgr.es/m/1311836.1597781384@sss.pgh.pa.us1 parent3e98c0b commit2072932
File tree
5 files changed
+106
-119
lines changed- src
- backend
- nodes
- optimizer
- path
- prep
- util
- include/nodes
5 files changed
+106
-119
lines changedLines changed: 62 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
575 | 575 |
| |
576 | 576 |
| |
577 | 577 |
| |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
578 | 637 |
| |
579 | 638 |
| |
580 | 639 |
| |
581 | 640 |
| |
582 |
| - | |
583 |
| - | |
584 |
| - | |
| 641 | + | |
585 | 642 |
| |
586 | 643 |
| |
587 | 644 |
| |
588 | 645 |
| |
589 |
| - | |
590 |
| - | |
591 |
| - | |
592 |
| - | |
593 |
| - | |
594 |
| - | |
595 |
| - | |
596 |
| - | |
597 |
| - | |
598 |
| - | |
| 646 | + | |
| 647 | + | |
599 | 648 |
| |
600 | 649 |
| |
601 | 650 |
| |
|
Lines changed: 17 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
490 | 490 |
| |
491 | 491 |
| |
492 | 492 |
| |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 | 493 |
| |
498 | 494 |
| |
499 | 495 |
| |
| |||
514 | 510 |
| |
515 | 511 |
| |
516 | 512 |
| |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
524 | 527 |
| |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
529 |
| - | |
530 |
| - | |
531 |
| - | |
532 |
| - | |
533 |
| - | |
534 |
| - | |
535 |
| - | |
536 |
| - | |
537 |
| - | |
538 |
| - | |
539 |
| - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
540 | 531 |
| |
541 | 532 |
| |
542 | 533 |
| |
|
Lines changed: 3 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1200 | 1200 |
| |
1201 | 1201 |
| |
1202 | 1202 |
| |
1203 |
| - | |
1204 |
| - | |
1205 |
| - | |
1206 |
| - | |
1207 |
| - | |
1208 |
| - | |
1209 |
| - | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
1210 | 1206 |
| |
1211 | 1207 |
| |
1212 | 1208 |
| |
|
Lines changed: 21 additions & 73 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
120 | 120 |
| |
121 | 121 |
| |
122 | 122 |
| |
123 |
| - | |
124 |
| - | |
125 |
| - | |
126 | 123 |
| |
127 | 124 |
| |
128 | 125 |
| |
| |||
2819 | 2816 |
| |
2820 | 2817 |
| |
2821 | 2818 |
| |
2822 |
| - | |
2823 |
| - | |
2824 |
| - | |
2825 |
| - | |
2826 |
| - | |
2827 |
| - | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
2828 | 2826 |
| |
2829 | 2827 |
| |
2830 | 2828 |
| |
| |||
2971 | 2969 |
| |
2972 | 2970 |
| |
2973 | 2971 |
| |
2974 |
| - | |
2975 |
| - | |
2976 |
| - | |
2977 |
| - | |
2978 |
| - | |
2979 |
| - | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
2980 | 2979 |
| |
2981 | 2980 |
| |
2982 | 2981 |
| |
| |||
3478 | 3477 |
| |
3479 | 3478 |
| |
3480 | 3479 |
| |
3481 |
| - | |
3482 |
| - | |
3483 |
| - | |
3484 |
| - | |
3485 |
| - | |
3486 |
| - | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
| 3486 | + | |
3487 | 3487 |
| |
3488 | 3488 |
| |
3489 | 3489 |
| |
| |||
3616 | 3616 |
| |
3617 | 3617 |
| |
3618 | 3618 |
| |
3619 |
| - | |
3620 |
| - | |
3621 |
| - | |
3622 |
| - | |
3623 |
| - | |
3624 |
| - | |
3625 |
| - | |
3626 |
| - | |
3627 |
| - | |
3628 |
| - | |
3629 |
| - | |
3630 |
| - | |
3631 |
| - | |
3632 |
| - | |
3633 |
| - | |
3634 |
| - | |
3635 |
| - | |
3636 |
| - | |
3637 |
| - | |
3638 |
| - | |
3639 |
| - | |
3640 |
| - | |
3641 |
| - | |
3642 |
| - | |
3643 |
| - | |
3644 |
| - | |
3645 |
| - | |
3646 |
| - | |
3647 |
| - | |
3648 |
| - | |
3649 |
| - | |
3650 |
| - | |
3651 |
| - | |
3652 |
| - | |
3653 |
| - | |
3654 |
| - | |
3655 |
| - | |
3656 |
| - | |
3657 |
| - | |
3658 |
| - | |
3659 |
| - | |
3660 |
| - | |
3661 |
| - | |
3662 |
| - | |
3663 |
| - | |
3664 |
| - | |
3665 |
| - | |
3666 |
| - | |
3667 |
| - | |
3668 |
| - | |
3669 |
| - | |
3670 |
| - | |
3671 | 3619 |
| |
3672 | 3620 |
| |
3673 | 3621 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 |
| |
40 | 43 |
| |
41 | 44 |
| |
|
0 commit comments
Comments
(0)