- Notifications
You must be signed in to change notification settings - Fork28
Commit2c535bf
committed
Fix incorrect optimization of foreign-key checks. When an UPDATE on the
referencing table does not change the tuple's FK column(s), we don't botherto check the PK table since the constraint was presumably already valid.However, the check is still necessary if the tuple was inserted by our owntransaction, since in that case the INSERT trigger will conclude it need notmake the check (since its version of the tuple has been deleted). We got thisright for simple cases, but not when the insert and update are in differentsubtransactions of the current top-level transaction; in such cases the FKcheck would never be made at all. (Hence, problem dates back to 8.0 whensubtransactions were added --- it's actually the subtransaction version of abug fixed in 7.3.5.) Fix, and add regression test cases. Report and fix byAffan Salman.1 parenta5ca334 commit2c535bf
File tree
3 files changed
+88
-3
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+88
-3
lines changedLines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
3396 | 3396 |
| |
3397 | 3397 |
| |
3398 | 3398 |
| |
3399 |
| - | |
3400 |
| - | |
| 3399 | + | |
3401 | 3400 |
| |
3402 | 3401 |
| |
3403 | 3402 |
| |
|
Lines changed: 37 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1193 | 1193 |
| |
1194 | 1194 |
| |
1195 | 1195 |
| |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + |
Lines changed: 49 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
830 | 830 |
| |
831 | 831 |
| |
832 | 832 |
| |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + |
0 commit comments
Comments
(0)