forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commita0ff371
committed
Fix BEFORE ROW trigger handling in cross-partition MERGE update.
Fix a bug during MERGE if a cross-partition update is attempted on apartitioned table with a BEFORE DELETE ROW trigger that returns NULL,to prevent the update. This would cause an error to be thrown, or anassert failure in an assert-enabled build.This was an oversight in9321c79, which failed to properlydistinguish a DELETE prevented by a trigger from one prevented by aconcurrent update. Fix by having ExecDelete() return the TM_Resultstatus to ExecCrossPartitionUpdate(), so that it can distinguish thetwo cases, and make ExecCrossPartitionUpdate() return the TM_Resultstatus to ExecUpdateAct(), so that it can return the correct statusfrom a concurrent update.In addition, ensure that the command tag is correctly updated byhaving ExecMergeMatched() pass canSetTag to ExecUpdateAct(), ratherthan passing false, so that it updates the command tag if it does across-partition update, making this code path in ExecMergeMatched()consistent with ExecUpdate().Per bug #18238 from Alexander Lakhin. Back-patch to v15, where MERGEwas introduced.Dean Rasheed, reviewed by Richard Guo and Jian He.Discussion:https://postgr.es/m/18238-2f2bdc7f720180b9%40postgresql.org1 parente557db1 commita0ff371
File tree
3 files changed
+167
-8
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+167
-8
lines changedLines changed: 12 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1425 | 1425 |
| |
1426 | 1426 |
| |
1427 | 1427 |
| |
| 1428 | + | |
1428 | 1429 |
| |
1429 | 1430 |
| |
1430 | 1431 |
| |
| |||
1441 | 1442 |
| |
1442 | 1443 |
| |
1443 | 1444 |
| |
1444 |
| - | |
| 1445 | + | |
1445 | 1446 |
| |
1446 | 1447 |
| |
1447 | 1448 |
| |
| |||
1496 | 1497 |
| |
1497 | 1498 |
| |
1498 | 1499 |
| |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
1499 | 1503 |
| |
1500 | 1504 |
| |
1501 | 1505 |
| |
| |||
1734 | 1738 |
| |
1735 | 1739 |
| |
1736 | 1740 |
| |
| 1741 | + | |
1737 | 1742 |
| |
1738 | 1743 |
| |
1739 | 1744 |
| |
| |||
1797 | 1802 |
| |
1798 | 1803 |
| |
1799 | 1804 |
| |
1800 |
| - | |
| 1805 | + | |
1801 | 1806 |
| |
1802 | 1807 |
| |
1803 | 1808 |
| |
| |||
1829 | 1834 |
| |
1830 | 1835 |
| |
1831 | 1836 |
| |
1832 |
| - | |
| 1837 | + | |
1833 | 1838 |
| |
1834 | 1839 |
| |
1835 | 1840 |
| |
| |||
2031 | 2036 |
| |
2032 | 2037 |
| |
2033 | 2038 |
| |
| 2039 | + | |
2034 | 2040 |
| |
2035 | 2041 |
| |
2036 | 2042 |
| |
| |||
2070 | 2076 |
| |
2071 | 2077 |
| |
2072 | 2078 |
| |
2073 |
| - | |
| 2079 | + | |
2074 | 2080 |
| |
2075 | 2081 |
| |
2076 | 2082 |
| |
| |||
2898 | 2904 |
| |
2899 | 2905 |
| |
2900 | 2906 |
| |
2901 |
| - | |
| 2907 | + | |
2902 | 2908 |
| |
2903 | 2909 |
| |
2904 | 2910 |
| |
| |||
2910 | 2916 |
| |
2911 | 2917 |
| |
2912 | 2918 |
| |
2913 |
| - | |
2914 |
| - | |
2915 | 2919 |
| |
2916 | 2920 |
| |
2917 | 2921 |
| |
| |||
3843 | 3847 |
| |
3844 | 3848 |
| |
3845 | 3849 |
| |
3846 |
| - | |
| 3850 | + | |
3847 | 3851 |
| |
3848 | 3852 |
| |
3849 | 3853 |
| |
|
Lines changed: 91 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1662 | 1662 |
| |
1663 | 1663 |
| |
1664 | 1664 |
| |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
1665 | 1669 |
| |
1666 | 1670 |
| |
1667 | 1671 |
| |
1668 | 1672 |
| |
1669 | 1673 |
| |
1670 | 1674 |
| |
1671 | 1675 |
| |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
1672 | 1681 |
| |
1673 | 1682 |
| |
1674 | 1683 |
| |
| |||
1725 | 1734 |
| |
1726 | 1735 |
| |
1727 | 1736 |
| |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
1728 | 1741 |
| |
1729 | 1742 |
| |
1730 | 1743 |
| |
1731 | 1744 |
| |
1732 | 1745 |
| |
1733 | 1746 |
| |
1734 | 1747 |
| |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
1735 | 1753 |
| |
1736 | 1754 |
| |
1737 | 1755 |
| |
| |||
1751 | 1769 |
| |
1752 | 1770 |
| |
1753 | 1771 |
| |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
| 1777 | + | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
1754 | 1845 |
| |
1755 | 1846 |
| |
1756 | 1847 |
| |
|
Lines changed: 64 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1060 | 1060 |
| |
1061 | 1061 |
| |
1062 | 1062 |
| |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1063 | 1067 |
| |
1064 | 1068 |
| |
1065 | 1069 |
| |
1066 | 1070 |
| |
1067 | 1071 |
| |
1068 | 1072 |
| |
1069 | 1073 |
| |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1070 | 1078 |
| |
1071 | 1079 |
| |
1072 | 1080 |
| |
| |||
1085 | 1093 |
| |
1086 | 1094 |
| |
1087 | 1095 |
| |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
1088 | 1124 |
| |
1089 | 1125 |
| |
1090 | 1126 |
| |
1091 | 1127 |
| |
1092 | 1128 |
| |
1093 | 1129 |
| |
1094 | 1130 |
| |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
1095 | 1159 |
| |
1096 | 1160 |
| |
1097 | 1161 |
| |
|
0 commit comments
Comments
(0)