[POSTGRESQL] az postgres flexible-server restore: Add --sku-name and --tier arguments to allow changing compute during point-in-time restore - #33992
Open
Gabriel Lobo (thegabrielobo) wants to merge 1 commit into
Conversation
…and `--tier` arguments to allow changing compute during point-in-time restore Point-in-time restore previously always inherited the source server's compute SKU. Users can now select a different compute size and tier for the restored server, matching the behavior already available for MySQL flexible servers. - When neither argument is supplied, behavior is unchanged and the restored server inherits the source server's SKU. - When only `--sku-name` is supplied, the tier is inherited from the source server and the SKU is validated against that tier. - When only `--tier` is supplied, the default SKU for that tier is used and a warning is emitted. - Downgrading below the source server's compute tier is rejected. `pg_restore_validator` now receives the resolved target tier rather than the source tier, so restoring a Burstable server to GeneralPurpose with `--storage-type PremiumV2_LRS` is no longer incorrectly rejected. Argument validation errors are also re-raised as-is instead of being masked as `ResourceNotFoundError` by the surrounding exception handler.
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
microsoft-github-policy-service
Bot
requested a review
from Yong Zhang (yonzhan)
August 26, 2026 09:11
Contributor
|
Thank you for your contribution Gabriel Lobo (@thegabrielobo)! We will review the pull request and get back to you soon. |
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
nasc17
self-requested a review
August 26, 2026 19:12
Collaborator
|
postgres |
Contributor
|
Gabriel Lobo (@thegabrielobo) please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
nasc17
reviewed
Aug 26, 2026
|
|
||
| class RestoreTierValidatorTest(unittest.TestCase): | ||
|
|
||
| def test_upgrading_tier_is_allowed(self): |
Member
There was a problem hiding this comment.
Instead add new args to restore test already in project and re-record results
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.
🤖 PR Validation —⚠️ Review suggested
Related command
az postgres flexible-server restoreDescription
Point-in-time restore previously always inherited the source server's compute SKU, so there was no way to resize a server during a restore. This adds
--sku-nameand--tiertoaz postgres flexible-server restore, matching capability already available onaz mysql flexible-server restore.Behavior:
--sku-nameonly--tieronlyDowngrading below the source server's compute tier is rejected, so a GeneralPurpose or MemoryOptimized server cannot be restored down to Burstable.
Two changes beyond the plain argument addition are worth reviewer attention:
pg_restore_validatornow receives the resolved target tier rather than the source server's tier. Previously a Burstable source could never be restored with--storage-type PremiumV2_LRS; restoring Burstable → GeneralPurpose with SSDv2 now works, which is the point of allowing a tier change.except Exception: raise ResourceNotFoundError(e). Without this, an invalid--tiersurfaced as a confusing "not found" error rather than the actual validation message.Tier ordering uses an explicit rank map rather than inferring order from the capability API's dictionary key order, which is not guaranteed stable.
Testing Guide
Restore with a different compute size, inheriting the source server's tier:
Restore with a different compute tier and size:
Restore with no compute arguments, which must behave exactly as before:
Downgrading the tier must be rejected:
Automated checks run locally:
azdev style postgresql— Pylint PASSED, Flake8 PASSEDazdev linter postgresql— no violationstest_postgres_flexible_restore_sku_params.py(7 tests, no network) covering argument registration andpg_restore_tier_validatorupgrade / same-tier / downgrade / Burstable / unknown-tier casesrestorescenario test still passes and is unmodifiedThe recorded scenario test was intentionally left untouched: adding new commands to it invalidates the committed cassette (
RecordMode.ONCE) and requires a live re-record, which is tracked as follow-up so the new arguments get end-to-end coverage.History Notes
[POSTGRESQL]
az postgres flexible-server restore: Add--sku-nameand--tierarguments to allow changing compute during point-in-time restore