forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5562272
committed
Check that partitions are not in use when dropping constraints
If the user creates a deferred constraint in a partition, and in atransaction they cause the constraint's trigger execution to be deferreduntil commit time *and* drop the constraint, then when commit time comesthe queued trigger will fail to run because the trigger object will havebeen dropped.This is explained because when a constraint gets dropped in apartitioned table, the recursion to drop the ones in partitions is doneby the dependency mechanism, not by ALTER TABLE traversing the recursiontree as in all other cases. In the non-partitioned case, this problemis avoided by checking that the table is not "in use" by alter-table;other alter-table subcommands that recurse to partitions do that checkfor each partition. But the dependency mechanism doesn't have a way todo that. Fix the problem by applying the same check to all partitionsduring ALTER TABLE's "prep" phase, which correctly raises the necessaryerror.Reported-by: Rajkumar Raghuwanshi <rajkumar.raghuwanshi@enterprisedb.com>Discussion:https://postgr.es/m/CAKcux6nZiO9-eEpr1ZD84bT1mBoVmeZkfont8iSpcmYrjhGWgA@mail.gmail.com1 parent24f62e9 commit5562272
File tree
3 files changed
+72
-11
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+72
-11
lines changedLines changed: 45 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
354 | 354 |
| |
355 | 355 |
| |
356 | 356 |
| |
| 357 | + | |
357 | 358 |
| |
358 | 359 |
| |
359 | 360 |
| |
| |||
3421 | 3422 |
| |
3422 | 3423 |
| |
3423 | 3424 |
| |
3424 |
| - | |
3425 |
| - | |
| 3425 | + | |
3426 | 3426 |
| |
3427 | 3427 |
| |
3428 | 3428 |
| |
| |||
3431 | 3431 |
| |
3432 | 3432 |
| |
3433 | 3433 |
| |
3434 |
| - | |
3435 |
| - | |
| 3434 | + | |
3436 | 3435 |
| |
3437 | 3436 |
| |
3438 | 3437 |
| |
| |||
3910 | 3909 |
| |
3911 | 3910 |
| |
3912 | 3911 |
| |
| 3912 | + | |
3913 | 3913 |
| |
3914 | 3914 |
| |
3915 |
| - | |
3916 |
| - | |
3917 |
| - | |
3918 |
| - | |
3919 | 3915 |
| |
3920 | 3916 |
| |
| 3917 | + | |
3921 | 3918 |
| |
3922 | 3919 |
| |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
3923 | 3925 |
| |
3924 | 3926 |
| |
3925 | 3927 |
| |
| |||
3985 | 3987 |
| |
3986 | 3988 |
| |
3987 | 3989 |
| |
3988 |
| - | |
| 3990 | + | |
| 3991 | + | |
3989 | 3992 |
| |
3990 | 3993 |
| |
3991 | 3994 |
| |
| |||
5224 | 5227 |
| |
5225 | 5228 |
| |
5226 | 5229 |
| |
5227 |
| - | |
5228 |
| - | |
| 5230 | + | |
| 5231 | + | |
| 5232 | + | |
5229 | 5233 |
| |
5230 | 5234 |
| |
5231 | 5235 |
| |
| |||
5259 | 5263 |
| |
5260 | 5264 |
| |
5261 | 5265 |
| |
| 5266 | + | |
| 5267 | + | |
| 5268 | + | |
| 5269 | + | |
| 5270 | + | |
| 5271 | + | |
| 5272 | + | |
| 5273 | + | |
| 5274 | + | |
| 5275 | + | |
| 5276 | + | |
| 5277 | + | |
| 5278 | + | |
| 5279 | + | |
| 5280 | + | |
| 5281 | + | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
| 5285 | + | |
| 5286 | + | |
| 5287 | + | |
| 5288 | + | |
| 5289 | + | |
| 5290 | + | |
| 5291 | + | |
| 5292 | + | |
| 5293 | + | |
| 5294 | + | |
| 5295 | + | |
5262 | 5296 |
| |
5263 | 5297 |
| |
5264 | 5298 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2379 | 2379 |
| |
2380 | 2380 |
| |
2381 | 2381 |
| |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
| 2390 | + | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + |
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1667 | 1667 |
| |
1668 | 1668 |
| |
1669 | 1669 |
| |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + |
0 commit comments
Comments
(0)