aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/createplan.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2025-06-29 13:56:03 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2025-06-29 13:56:03 -0400
commit8319e5cb5493046e65d60da3cc17ab78c91749b1 (patch)
tree9eac01cb764f4d37e8851d97cb4d540b09138527 /src/backend/optimizer/plan/createplan.c
parent6d12d5a433c9c8cbf92fc19afd2a3465f275564c (diff)
downloadpostgresql-8319e5cb5493046e65d60da3cc17ab78c91749b1.tar.gz
postgresql-8319e5cb5493046e65d60da3cc17ab78c91749b1.zip
Obtain required table lock during cross-table constraint updates.
Sometimes a table's constraint may depend on a column of another table, so that we have to update the constraint when changing the referenced column's type. We need to have lock on the constraint's table to do that. ATPostAlterTypeCleanup believed that this case was only possible for FOREIGN KEY constraints, but it's wrong at least for CHECK and EXCLUDE constraints; and in general, we'd probably need exclusive lock to alter any sort of constraint. So just remove the contype check and acquire lock for any other table. 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 support physically altering column types within stored composite columns. But the catalog-munging is basically all there, so we may as well make that part work. Bug: #18970 Reported-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.org Backpatch-through: 13
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
0 files changed, 0 insertions, 0 deletions