-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[RDBMS] az postgres flexible-server create: Add database name field for create with cluster
#32570
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
[RDBMS] az postgres flexible-server create: Add database name field for create with cluster
#32570
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| postgres flexible-server create | cmd postgres flexible-server create added parameter database_name |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a --database-name parameter to the az postgres flexible-server create command, allowing users to specify a custom database name when creating an elastic cluster. When not provided, the database name defaults to 'postgres'.
Key Changes
- Added
database_nameparameter to theflexible_server_createfunction signature - Integrated the parameter into elastic cluster creation logic to set custom default database names
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
flexible_server_custom_postgres.py |
Added database_name parameter to function signature and used it in elastic cluster creation to set the default database name |
_params.py |
Registered the database_name argument for the postgres flexible-server create command using the pre-existing database_name_create_arg_type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if create_cluster == 'ElasticCluster': | ||
| cluster_size = cluster_size if cluster_size else 2 | ||
| cluster = postgresql_flexibleservers.models.Cluster(cluster_size=cluster_size, default_database_name=POSTGRES_DB_NAME) | ||
| cluster = postgresql_flexibleservers.models.Cluster(cluster_size=cluster_size, default_database_name=database_name if database_name else POSTGRES_DB_NAME) |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database_name parameter is used here without being validated by the pg_arguments_validator function. The validator function (defined in validators.py) accepts a database_name parameter and performs format validation to ensure it begins with a letter or underscore, contains only valid characters (letters, digits, hyphens, underscores), and is less than 64 characters. You should add database_name=database_name to the validator call above (around line 112-136) to ensure invalid database names are caught early with a proper error message rather than failing later in the process.
| if create_cluster == 'ElasticCluster': | ||
| cluster_size = cluster_size if cluster_size else 2 | ||
| cluster = postgresql_flexibleservers.models.Cluster(cluster_size=cluster_size, default_database_name=POSTGRES_DB_NAME) | ||
| cluster = postgresql_flexibleservers.models.Cluster(cluster_size=cluster_size, default_database_name=database_name if database_name else POSTGRES_DB_NAME) |
Copilot
AI
Dec 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database_name parameter is only used when creating an elastic cluster (create_cluster == 'ElasticCluster'). This means if a user provides the --database-name parameter when creating a regular server (not an elastic cluster), it will be silently ignored. Consider either: (1) adding validation to reject the parameter when not creating an elastic cluster with a clear error message, or (2) updating the help text for the parameter to clearly indicate it only applies to elastic clusters to avoid user confusion.
az postgres flexible-server create: Added database name field for createaz postgres flexible-server create: Add database name field for create
az postgres flexible-server create: Add database name field for createaz postgres flexible-server create: Add database name field for create with cluster
|
@evelyn-ys do you mind reviewing this PR? |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
… for create
Related command
az postgres flexible-server create
Description
Added database name field for create with cluster
Testing Guide

History Notes
[RDBMS]
az postgres flexible-server create: Add database name field for create with clusterThis 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.