[POSTGRESQL] az postgres flexible-server backup create: Fix duplicate auto-generated backup names after deletions#33684
Open
mattboentoro wants to merge 1 commit into
Open
Conversation
…te auto-generated backup names after deletions
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a name-collision bug in az postgres flexible-server backup create when the backup name is auto-generated and earlier backups have been deleted, ensuring the generated name is unique among existing backups.
Changes:
- Replace the one-time collision fallback (
+1then+2) with a loop that increments the numeric suffix until an unused name is found. - Keep the generated naming format (
ondemandbackup-<MMDDYYYY>-<N>) while making suffix selection robust to deletions.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+24
to
+28
| suffix = on_demand_count + 1 | ||
| backup_name = f"{_BACKUP_NAME_PREFIX}-{date_str}-{suffix}" | ||
| while backup_name in existing_names: | ||
| suffix += 1 | ||
| backup_name = f"{_BACKUP_NAME_PREFIX}-{date_str}-{suffix}" |
nasc17
approved these changes
Jun 30, 2026
Collaborator
|
POSTGRESQL |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
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.
Related command
az postgres flexible-server backup create
Description
Fix duplicate auto-generated backup names after deletions
Testing Guide
Manual testing
History Notes
[POSTGRESQL]
az postgres flexible-server backup create: Fix duplicate auto-generated backup names after deletionsThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.