aboutsummaryrefslogtreecommitdiff
path: root/contrib/test_decoding/test_decoding.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-01-29 08:05:59 +0900
committerMichael Paquier <michael@paquier.xyz>2024-01-29 08:05:59 +0900
commit50b797dc99ec3bf97ea5d0955a3b42d356c1522d (patch)
tree6b14e8c67ce287e032373fcf5580ac21c742788c /contrib/test_decoding/test_decoding.c
parenta3a836fb5e51183eae624d43225279306c2285b8 (diff)
downloadpostgresql-50b797dc99ec3bf97ea5d0955a3b42d356c1522d.tar.gz
postgresql-50b797dc99ec3bf97ea5d0955a3b42d356c1522d.zip
Fix DROP ROLE when specifying duplicated roles
This commit fixes failures with "tuple already updated by self" when listing twice the same role and in a DROP ROLE query. This is an oversight in 6566133c5f52, that has introduced a two-phase logic in DropRole() where dependencies of all the roles to drop are removed in a first phase, with the roles themselves removed from pg_authid in a second phase. The code is simplified to not rely on a List of ObjectAddress built in the first phase used to remove the pg_authid entries in the second phase, switching to a list of OIDs. Duplicated OIDs can be simply avoided in the first phase thanks to that. Using ObjectAddress was not necessary for the roles as they are not used for anything specific to dependency.c, building all the ObjectAddress in the List with AuthIdRelationId as class ID. In 15 and older versions, where a single phase is used, DROP ROLE with duplicated role names would fail on "role \"blah\" does not exist" for the second entry after the CCI() done by the first deletion. This is not really incorrect, but it does not seem worth changing based on a lack of complaints. Reported-by: Alexander Lakhin Reviewed-by: Tender Wang Discussion: https://postgr.es/m/18310-1eb233c5908189c8@postgresql.org Backpatch-through: 16
Diffstat (limited to 'contrib/test_decoding/test_decoding.c')
0 files changed, 0 insertions, 0 deletions