- Notifications
You must be signed in to change notification settings - Fork28
Commit6009bad
committed
Fix ALTER/TYPE on columns referenced by FKs in partitioned tables
When ALTER TABLE ... SET DATA TYPE affects a column referenced byconstraints and indexes, it drop those constraints and indexes andrecreates them afterwards, so that the definitions match the new datatype. The original code did this by dropping one object at a time(commit077db40 of May 2004), which worked fine because thedependencies between the objects were pretty straightforward, andordering the objects in a specific way was enough to make this work.However, when there are foreign key constraints in partitioned tables,the dependencies are no longer so straightforward, and we were gettingerrors when attempted: ERROR: cache lookup failed for constraint 16398This can be fixed by doing all the drops in one pass instead, usingperformMultipleDeletions (introduced bydf18c51 of Aug 2006). Withthis change we can also remove the code to carefully order the list ofobjects to be deleted.Reported-by: Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CAKcux6nWS_m+s=1Udk_U9B+QY7pA-Ac58qR5BdUfOyrwnWHDew@mail.gmail.com1 parent830d756 commit6009bad
File tree
3 files changed
+47
-47
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+47
-47
lines changedLines changed: 24 additions & 47 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
9496 | 9496 |
| |
9497 | 9497 |
| |
9498 | 9498 |
| |
9499 |
| - | |
9500 |
| - | |
9501 |
| - | |
9502 |
| - | |
9503 |
| - | |
9504 |
| - | |
9505 |
| - | |
9506 |
| - | |
9507 |
| - | |
9508 |
| - | |
9509 |
| - | |
9510 |
| - | |
9511 |
| - | |
9512 |
| - | |
9513 |
| - | |
9514 |
| - | |
9515 |
| - | |
9516 |
| - | |
9517 |
| - | |
9518 |
| - | |
9519 |
| - | |
9520 |
| - | |
9521 |
| - | |
9522 |
| - | |
9523 |
| - | |
9524 |
| - | |
9525 |
| - | |
| 9499 | + | |
| 9500 | + | |
| 9501 | + | |
| 9502 | + | |
| 9503 | + | |
| 9504 | + | |
9526 | 9505 |
| |
9527 | 9506 |
| |
9528 | 9507 |
| |
| |||
9862 | 9841 |
| |
9863 | 9842 |
| |
9864 | 9843 |
| |
| 9844 | + | |
9865 | 9845 |
| |
9866 | 9846 |
| |
9867 | 9847 |
| |
| 9848 | + | |
| 9849 | + | |
| 9850 | + | |
| 9851 | + | |
| 9852 | + | |
| 9853 | + | |
| 9854 | + | |
9868 | 9855 |
| |
9869 | 9856 |
| |
9870 | 9857 |
| |
| |||
9906 | 9893 |
| |
9907 | 9894 |
| |
9908 | 9895 |
| |
| 9896 | + | |
| 9897 | + | |
| 9898 | + | |
9909 | 9899 |
| |
9910 | 9900 |
| |
9911 | 9901 |
| |
| |||
9929 | 9919 |
| |
9930 | 9920 |
| |
9931 | 9921 |
| |
| 9922 | + | |
| 9923 | + | |
| 9924 | + | |
9932 | 9925 |
| |
9933 | 9926 |
| |
9934 | 9927 |
| |
9935 |
| - | |
9936 |
| - | |
9937 |
| - | |
9938 |
| - | |
9939 |
| - | |
9940 |
| - | |
| 9928 | + | |
| 9929 | + | |
9941 | 9930 |
| |
9942 |
| - | |
9943 |
| - | |
9944 |
| - | |
9945 |
| - | |
9946 |
| - | |
9947 |
| - | |
9948 |
| - | |
| 9931 | + | |
9949 | 9932 |
| |
9950 |
| - | |
9951 |
| - | |
9952 |
| - | |
9953 |
| - | |
9954 |
| - | |
9955 |
| - | |
9956 |
| - | |
| 9933 | + | |
9957 | 9934 |
| |
9958 | 9935 |
| |
9959 | 9936 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1518 | 1518 |
| |
1519 | 1519 |
| |
1520 | 1520 |
| |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
1521 | 1533 |
| |
1522 | 1534 |
| |
1523 | 1535 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1139 | 1139 |
| |
1140 | 1140 |
| |
1141 | 1141 |
| |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
1142 | 1153 |
| |
1143 | 1154 |
| |
1144 | 1155 |
| |
|
0 commit comments
Comments
(0)