Feat/createrole preflight check - #1055
Open
lghuy05 wants to merge 17 commits into
Open
Conversation
…arget-createdb-privileges # Conflicts: # internal/postgres/pg_restore_test.go
CoverageTotal: 58.7% (+0.2% vs Coverage in packages changed by this PR:
|
Collaborator
|
@lghuy05 I have merged your previous PR. Could you please rebase your changes? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an access preflight check that verifies the target PostgreSQL connection role can create roles when schema snapshots are configured to restore roles.
The check runs when
roles_snapshot_modeisenabledorno_passwordsand accepts either theCREATEROLEattribute or superuser capability.Related Issue(s)
pgstream checkcommand for pre-migration sanity checks #897Type of Change
Please select the relevant option(s):
Changes Made
TargetCreateRolePrivilegeCheckto query the target connection role'sCREATEROLEor superuser capability.roles_snapshot_modeisenabledorno_passwords.Testing
Checklist
Additional Notes
The target connection URL is adjusted using the existing
postgres.RemoveDatabaseFromConnectionStringhelper. PostgreSQL roles are cluster-wide, so the check can run even when the configured target database does not exist yet.The
CREATEDBandCREATEROLEbuilder paths remain separate to avoid expanding this PR into a refactor while #996 is still open. They can share a target connection in a later cleanup.