- Notifications
You must be signed in to change notification settings - Fork4.9k
Commite1f186d
committed
Fix some corner-case issues in REFRESH MATERIALIZED VIEW CONCURRENTLY.
refresh_by_match_merge() has some issues in the way it builds a SQLquery to construct the "diff" table:1. It doesn't require the selected unique index(es) to be indimmediate.2. It doesn't pay attention to the particular equality semantics enforcedby a given index, but just assumes that they must be those of the columndatatype's default btree opclass.3. It doesn't check that the indexes are btrees.4. It's insufficiently careful to ensure that the parser will pick theintended operator when parsing the query. (This would have been asecurity bug beforeCVE-2018-1058.)5. It's not careful about indexes on system columns.The way tofix#4 is to make use of the existing code in ri_triggers.cfor generating an arbitrary binary operator clause. I chose to movethat to ruleutils.c, since that seems a more reasonable place to beexporting such functionality from than ri_triggers.c.While#1,#3, and#5 are just latent given existing feature restrictions,and#2 doesn't arise in the core system for lack of alternate opclasseswith different equality behaviors,#4 seems like an issue worthback-patching. That's the bulk of the change anyway, so just back-patchthe whole thing to 9.4 where this code was introduced.Discussion:https://postgr.es/m/13836.1521413227@sss.pgh.pa.us1 parentb6ba94e commite1f186d
File tree
4 files changed
+203
-111
lines changed- src
- backend
- commands
- utils/adt
- include/utils
4 files changed
+203
-111
lines changedLines changed: 112 additions & 49 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
| 24 | + | |
23 | 25 |
| |
24 | 26 |
| |
25 | 27 |
| |
| |||
38 | 40 |
| |
39 | 41 |
| |
40 | 42 |
| |
41 |
| - | |
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
| |
| |||
60 | 61 |
| |
61 | 62 |
| |
62 | 63 |
| |
63 |
| - | |
64 | 64 |
| |
65 |
| - | |
66 |
| - | |
67 | 65 |
| |
68 | 66 |
| |
69 | 67 |
| |
70 |
| - | |
| 68 | + | |
71 | 69 |
| |
72 | 70 |
| |
73 | 71 |
| |
| |||
477 | 475 |
| |
478 | 476 |
| |
479 | 477 |
| |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
486 |
| - | |
487 |
| - | |
488 |
| - | |
489 |
| - | |
490 |
| - | |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 |
| - | |
499 | 478 |
| |
500 | 479 |
| |
501 | 480 |
| |
| |||
543 | 522 |
| |
544 | 523 |
| |
545 | 524 |
| |
546 |
| - | |
| 525 | + | |
547 | 526 |
| |
548 | 527 |
| |
549 | 528 |
| |
| |||
555 | 534 |
| |
556 | 535 |
| |
557 | 536 |
| |
558 |
| - | |
559 | 537 |
| |
560 | 538 |
| |
561 | 539 |
| |
| |||
619 | 597 |
| |
620 | 598 |
| |
621 | 599 |
| |
| 600 | + | |
622 | 601 |
| |
| 602 | + | |
623 | 603 |
| |
624 | 604 |
| |
625 | 605 |
| |
626 | 606 |
| |
627 | 607 |
| |
628 | 608 |
| |
629 |
| - | |
630 | 609 |
| |
631 | 610 |
| |
632 |
| - | |
633 |
| - | |
634 |
| - | |
635 |
| - | |
636 |
| - | |
637 |
| - | |
638 |
| - | |
639 |
| - | |
640 |
| - | |
641 |
| - | |
| 611 | + | |
642 | 612 |
| |
| 613 | + | |
643 | 614 |
| |
| 615 | + | |
| 616 | + | |
| 617 | + | |
644 | 618 |
| |
645 | 619 |
| |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
646 | 628 |
| |
647 | 629 |
| |
648 | 630 |
| |
649 | 631 |
| |
650 |
| - | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
651 | 639 |
| |
652 |
| - | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
653 | 661 |
| |
654 | 662 |
| |
655 |
| - | |
656 |
| - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
657 | 672 |
| |
658 |
| - | |
| 673 | + | |
659 | 674 |
| |
660 |
| - | |
| 675 | + | |
661 | 676 |
| |
662 | 677 |
| |
663 | 678 |
| |
664 | 679 |
| |
665 | 680 |
| |
666 | 681 |
| |
667 | 682 |
| |
668 |
| - | |
669 |
| - | |
670 |
| - | |
671 |
| - | |
672 |
| - | |
673 |
| - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
674 | 692 |
| |
675 | 693 |
| |
676 | 694 |
| |
| |||
762 | 780 |
| |
763 | 781 |
| |
764 | 782 |
| |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
765 | 828 |
| |
766 | 829 |
| |
767 | 830 |
| |
|
Lines changed: 7 additions & 62 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
207 | 207 |
| |
208 | 208 |
| |
209 | 209 |
| |
210 |
| - | |
211 | 210 |
| |
212 | 211 |
| |
213 | 212 |
| |
| |||
2547 | 2546 |
| |
2548 | 2547 |
| |
2549 | 2548 |
| |
2550 |
| - | |
2551 |
| - | |
2552 |
| - | |
2553 |
| - | |
2554 |
| - | |
2555 |
| - | |
2556 |
| - | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
2557 | 2553 |
| |
2558 | 2554 |
| |
2559 | 2555 |
| |
| |||
2562 | 2558 |
| |
2563 | 2559 |
| |
2564 | 2560 |
| |
2565 |
| - | |
2566 |
| - | |
2567 |
| - | |
2568 |
| - | |
2569 |
| - | |
2570 |
| - | |
2571 |
| - | |
2572 |
| - | |
2573 |
| - | |
2574 |
| - | |
2575 |
| - | |
2576 |
| - | |
2577 |
| - | |
2578 |
| - | |
2579 |
| - | |
2580 |
| - | |
2581 |
| - | |
2582 |
| - | |
2583 |
| - | |
2584 |
| - | |
2585 |
| - | |
2586 |
| - | |
2587 |
| - | |
2588 |
| - | |
2589 |
| - | |
2590 |
| - | |
2591 |
| - | |
2592 |
| - | |
2593 |
| - | |
2594 |
| - | |
2595 |
| - | |
2596 |
| - | |
2597 |
| - | |
2598 |
| - | |
2599 |
| - | |
2600 |
| - | |
2601 |
| - | |
2602 |
| - | |
2603 |
| - | |
2604 |
| - | |
2605 |
| - | |
2606 |
| - | |
2607 |
| - | |
2608 |
| - | |
2609 |
| - | |
2610 |
| - | |
2611 |
| - | |
2612 |
| - | |
2613 |
| - | |
2614 |
| - | |
2615 |
| - | |
2616 |
| - | |
2617 |
| - | |
2618 |
| - | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
2619 | 2564 |
| |
2620 | 2565 |
| |
2621 | 2566 |
| |
|
0 commit comments
Comments
(0)