8000 WIP: Implement support for copying roles. by dimitri · Pull Request #64 · dimitri/pgcopydb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

WIP: Implement support for copying roles. #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 5, 2022
Merged

Conversation

dimitri
Copy link
Owner
@dimitri dimitri commented Jul 4, 2022

Postgres roles are global objects, which means they do not belong to any
specific database in an instance. To be able to dump and restore the roles,
we need to use pg_dumpall --roles-only.

Fixed #49.

dimitri added 8 commits July 4, 2022 15:52
8000
Postgres roles are global objects, which means they do not belong to any
specific database in an instance. To be able to dump and restore the roles,
we need to use pg_dumpall --roles-only.
This allows to implement "create role if not exists" our own way, accepting
roles that already exists as they are.
In testing it's nice to use ROLLBACK to try again and again... not in the
code we want to ship.
We now create a "pagila" role and make it owner of the database and its
objects, and then run the pgcopydb commands using that new non-superuser
role.

The creation of the new role on the target system is made by calling into
pgcopydb dump roles and pgcopydb restore roles.
This includes a STEP 0 that copies the roles from the source instance to the
target instance.
@dimitri dimitri merged commit e8b4774 into main Jul 5, 2022
@dimitri dimitri del 774F eted the feature/dumpall-roles branch July 5, 2022 14:35
hanefi pushed a commit to hanefi/pgcopydb that referenced this pull request Feb 21, 2025
…Variable warnings (dimitri#64)

* Fix cppcheck variableScope, shadowArgument, shadowFunction and shadowVariable warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for roles (global objects)
1 participant
0