forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit50b797d
committed
Fix DROP ROLE when specifying duplicated roles
This commit fixes failures with "tuple already updated by self" whenlisting twice the same role and in a DROP ROLE query.This is an oversight in6566133, that has introduced a two-phaselogic in DropRole() where dependencies of all the roles to drop areremoved in a first phase, with the roles themselves removed frompg_authid in a second phase.The code is simplified to not rely on a List of ObjectAddress built inthe first phase used to remove the pg_authid entries in the secondphase, switching to a list of OIDs. Duplicated OIDs can be simplyavoided in the first phase thanks to that. Using ObjectAddress was notnecessary for the roles as they are not used for anything specific todependency.c, building all the ObjectAddress in the List withAuthIdRelationId as class ID.In 15 and older versions, where a single phase is used, DROP ROLE withduplicated role names would fail on "role \"blah\" does not exist" forthe second entry after the CCI() done by the first deletion. This isnot really incorrect, but it does not seem worth changing based on alack of complaints.Reported-by: Alexander LakhinReviewed-by: Tender WangDiscussion:https://postgr.es/m/18310-1eb233c5908189c8@postgresql.orgBackpatch-through: 161 parenta3a836f commit50b797d
File tree
3 files changed
+9
-13
lines changed- src
- backend/commands
- test/regress
- expected
- sql
3 files changed
+9
-13
lines changedLines changed: 5 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1093 | 1093 |
| |
1094 | 1094 |
| |
1095 | 1095 |
| |
1096 |
| - | |
| 1096 | + | |
1097 | 1097 |
| |
1098 | 1098 |
| |
1099 | 1099 |
| |
| |||
1119 | 1119 |
| |
1120 | 1120 |
| |
1121 | 1121 |
| |
1122 |
| - | |
1123 | 1122 |
| |
1124 | 1123 |
| |
1125 | 1124 |
| |
| |||
1260 | 1259 |
| |
1261 | 1260 |
| |
1262 | 1261 |
| |
1263 |
| - | |
1264 |
| - | |
1265 |
| - | |
1266 |
| - | |
1267 |
| - | |
1268 |
| - | |
| 1262 | + | |
| 1263 | + | |
1269 | 1264 |
| |
1270 | 1265 |
| |
1271 | 1266 |
| |
1272 | 1267 |
| |
1273 | 1268 |
| |
1274 |
| - | |
| 1269 | + | |
1275 | 1270 |
| |
1276 |
| - | |
1277 |
| - | |
| 1271 | + | |
1278 | 1272 |
| |
1279 | 1273 |
| |
1280 | 1274 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
251 | 251 |
| |
252 | 252 |
| |
253 | 253 |
| |
254 |
| - | |
| 254 | + | |
| 255 | + | |
255 | 256 |
| |
256 | 257 |
| |
257 | 258 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
206 | 206 |
| |
207 | 207 |
| |
208 | 208 |
| |
209 |
| - | |
| 209 | + | |
| 210 | + | |
210 | 211 |
| |
211 | 212 |
| |
212 | 213 |
| |
|
0 commit comments
Comments
(0)