Skip to content

Add target CREATEDB preflight check for snapshot DB creation#996

Open
lghuy05 wants to merge 6 commits into
xataio:mainfrom
lghuy05:feat/target-createdb-privileges
Open

Add target CREATEDB preflight check for snapshot DB creation#996
lghuy05 wants to merge 6 commits into
xataio:mainfrom
lghuy05:feat/target-createdb-privileges

Conversation

@lghuy05

@lghuy05 lghuy05 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a new access preflight check for pgstream check to verify that the target Postgres role has the CREATEDB privilege when snapshot schema restore is configured with created_target_db: true.

Related Issue(s)

Type of Change

Please select the relevant option(s):

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test coverage improvement
  • 🔨 Build/CI changes
  • 🧹 Code cleanup

Changes Made

  • Added TargetCreateDBPrivilegeCheck to the access preflight checks
  • Wired the check to run only when snapshot dump/restore is configured with create_target_db: true
  • Added unit tests for the new check and builder coverage for the conditional access check registration

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Code is well-commented
  • Documentation updated where necessary

Additional Notes

This change only applies to the snapshot schema restore path for Postgres targets. The new check validates the current target session role by querying pg_roles for rolcreatedb, and returns an actionable finding when the privilege is missing.

@lghuy05 lghuy05 changed the title Feat/target createdb privileges Add target CREATEDB preflight check for snapshot DB creation Jul 11, 2026
@lghuy05

lghuy05 commented Jul 12, 2026

Copy link
Copy Markdown
Contributor Author

I will resolve the conflict in a few days

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.

2 participants