[DO NOT MERGE] Support adding users to db_owner role
Description
This commit adds support to alter the db_owner role and add/drop users from it.
Whenever a new user, say u1, is added to db_owner role, we will internally create a new role u1_obj which will be owner of all the objects of u1. By doing so, we are able to work around the cyclic dependency of role membership in postgres. If u1 creates new objects, using the pre-existing post object creation hook, we will reassign ownership of u1's objects to u1_obj.
Similarly, if u1 is dropped from db_owner role, we will drop the u1_obj role and reassign ownership u1's objects from u1_obj role back to u1.
Test Scenarios Covered
-
Use case based -
-
Boundary conditions -
-
Arbitrary inputs -
-
Negative test cases -
-
Minor version upgrade tests -
-
Major version upgrade tests -
-
Performance tests -
-
Tooling impact -
-
Client tests -
Check List
- [x] Commits are signed per the DCO using --signoff
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Pull Request Test Coverage Report for Build 11250785327
Details
- 266 of 275 (96.73%) changed or added relevant lines in 7 files are covered.
- 38 unchanged lines in 2 files lost coverage.
- Overall coverage increased (+0.07%) to 74.541%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| contrib/babelfishpg_tsql/src/dbcmds.c | 7 | 8 | 87.5% |
| contrib/babelfishpg_tsql/src/pl_handler.c | 14 | 15 | 93.33% |
| contrib/babelfishpg_tsql/src/pltsql_utils.c | 13 | 14 | 92.86% |
| contrib/babelfishpg_tsql/src/rolecmds.c | 220 | 226 | 97.35% |
| <!-- | Total: | 266 | 275 |
| Files with Coverage Reduction | New Missed Lines | % |
|---|---|---|
| contrib/babelfishpg_tsql/src/dbcmds.c | 17 | 72.85% |
| contrib/babelfishpg_tsql/src/rolecmds.c | 21 | 84.12% |
| <!-- | Total: | 38 |
| Totals | |
|---|---|
| Change from base Build 11164747429: | 0.07% |
| Covered Lines: | 45345 |
| Relevant Lines: | 60832 |