aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/nodeFuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-03-21 12:22:13 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-03-21 12:22:13 -0400
commit7b6ec86532c2ca585d671239bba867fe380448ed (patch)
treeb8ff9888fea2cf8433cbe917bd3256ac45f348d1 /src/backend/nodes/nodeFuncs.c
parent1f8bc448680bf93a974cb5f52d496514ff67720c (diff)
downloadpostgresql-7b6ec86532c2ca585d671239bba867fe380448ed.tar.gz
postgresql-7b6ec86532c2ca585d671239bba867fe380448ed.zip
Fix risk of deadlock failure while dropping a partitioned index.
DROP INDEX needs to lock the index's table before the index itself, else it will deadlock against ordinary queries that acquire the relation locks in that order. This is correctly mechanized for plain indexes by RangeVarCallbackForDropRelation; but in the case of a partitioned index, we neglected to lock the child tables in advance of locking the child indexes. We can fix that by traversing the inheritance tree and acquiring the needed locks in RemoveRelations, after we have acquired our locks on the parent partitioned table and index. While at it, do some refactoring to eliminate confusion between the actual and expected relkind in RangeVarCallbackForDropRelation. We can save a couple of syscache lookups too, by having that function pass back info that RemoveRelations will need. Back-patch to v11 where partitioned indexes were added. Jimmy Yih, Gaurab Dey, Tom Lane Discussion: https://postgr.es/m/BYAPR05MB645402330042E17D91A70C12BD5F9@BYAPR05MB6454.namprd05.prod.outlook.com
Diffstat (limited to 'src/backend/nodes/nodeFuncs.c')
0 files changed, 0 insertions, 0 deletions