forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit641f3df
committed
Restore the previous semantics of get_constraint_index().
Commit8b069ef changed this function to look at pg_constraint.conindidrather than searching pg_depend. That was a good performance improvement,but it failed to preserve the exact semantics. The old code would onlyreturn an index that was "owned by" (internally dependent on) thespecified constraint, whereas the new code will also return indexes thatare just referenced by foreign key constraints. This confuses ALTERTABLE, which was implicitly expecting the previous semantics, intofailing with errors like ERROR: relation 146621 has multiple clustered indexesor ERROR: "pk_attbl" is not an index for table "atref"We can fix this without reverting the performance improvement by addinga contype check in get_constraint_index(). Another way could be tomake ALTER TABLE check it, but I'm worried that extension code couldalso have subtle dependencies on the old semantics.Tom Lane and Japin Li, per bug #17409 from Holly Roberts.Back-patch to v14 where the error crept in.Discussion:https://postgr.es/m/17409-52871dda8b5741cb@postgresql.org1 parentd6f1cde commit641f3df
File tree
3 files changed
+45
-3
lines changed- src
- backend/utils/cache
- test/regress
- expected
- sql
3 files changed
+45
-3
lines changedLines changed: 13 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1126 | 1126 |
| |
1127 | 1127 |
| |
1128 | 1128 |
| |
1129 |
| - | |
1130 |
| - | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
1131 | 1136 |
| |
1132 | 1137 |
| |
1133 | 1138 |
| |
| |||
1140 | 1145 |
| |
1141 | 1146 |
| |
1142 | 1147 |
| |
1143 |
| - | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
1144 | 1154 |
| |
1145 | 1155 |
| |
1146 | 1156 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4502 | 4502 |
| |
4503 | 4503 |
| |
4504 | 4504 |
| |
| 4505 | + | |
| 4506 | + | |
| 4507 | + | |
| 4508 | + | |
| 4509 | + | |
| 4510 | + | |
| 4511 | + | |
| 4512 | + | |
| 4513 | + | |
| 4514 | + | |
| 4515 | + | |
| 4516 | + | |
| 4517 | + | |
| 4518 | + | |
4505 | 4519 |
| |
4506 | 4520 |
| |
4507 | 4521 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2958 | 2958 |
| |
2959 | 2959 |
| |
2960 | 2960 |
| |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
2961 | 2979 |
| |
2962 | 2980 |
| |
2963 | 2981 |
| |
|
0 commit comments
Comments
(0)