- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit8319e5c
committed
Obtain required table lock during cross-table constraint updates.
Sometimes a table's constraint may depend on a column of anothertable, so that we have to update the constraint when changing thereferenced column's type. We need to have lock on the constraint'stable to do that. ATPostAlterTypeCleanup believed that this casewas only possible for FOREIGN KEY constraints, but it's wrong atleast for CHECK and EXCLUDE constraints; and in general, we'dprobably need exclusive lock to alter any sort of constraint.So just remove the contype check and acquire lock for any othertable. This prevents a "you don't have lock" assertion failure,though no ill effect is observed in production builds.We'll error out later anyway because we don't presently supportphysically altering column types within stored composite columns.But the catalog-munging is basically all there, so we may as wellmake that part work.Bug: #18970Reported-by: Alexander Lakhin <exclusion@gmail.com>Diagnosed-by: jian he <jian.universality@gmail.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/18970-a7d1cfe1f8d5d8d9@postgresql.orgBackpatch-through: 131 parent6d12d5a commit8319e5c
File tree
3 files changed
+27
-10
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+27
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15415 | 15415 | | |
15416 | 15416 | | |
15417 | 15417 | | |
15418 | | - | |
15419 | | - | |
15420 | | - | |
| 15418 | + | |
| 15419 | + | |
| 15420 | + | |
| 15421 | + | |
| 15422 | + | |
| 15423 | + | |
15421 | 15424 | | |
15422 | 15425 | | |
15423 | 15426 | | |
| |||
15433 | 15436 | | |
15434 | 15437 | | |
15435 | 15438 | | |
15436 | | - | |
15437 | 15439 | | |
15438 | 15440 | | |
15439 | 15441 | | |
| |||
15450 | 15452 | | |
15451 | 15453 | | |
15452 | 15454 | | |
15453 | | - | |
15454 | 15455 | | |
15455 | 15456 | | |
15456 | 15457 | | |
| |||
15468 | 15469 | | |
15469 | 15470 | | |
15470 | 15471 | | |
15471 | | - | |
15472 | | - | |
15473 | | - | |
15474 | | - | |
| 15472 | + | |
| 15473 | + | |
| 15474 | + | |
| 15475 | + | |
15475 | 15476 | | |
15476 | | - | |
| 15477 | + | |
15477 | 15478 | | |
15478 | 15479 | | |
15479 | 15480 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4745 | 4745 | | |
4746 | 4746 | | |
4747 | 4747 | | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
4748 | 4755 | | |
4749 | 4756 | | |
4750 | 4757 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3069 | 3069 | | |
3070 | 3070 | | |
3071 | 3071 | | |
| 3072 | + | |
| 3073 | + | |
| 3074 | + | |
| 3075 | + | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
3072 | 3081 | | |
3073 | 3082 | | |
3074 | 3083 | | |
| |||
0 commit comments
Comments
(0)