Skip to content

Commit 2af5cc9

Browse files
authored
[RDBMS] az postgres flexible-server create/db create: BUG FIX, validation for database name (#31542)
1 parent 98e8725 commit 2af5cc9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ def _flexible_server_params(command_group):
267267
id_part='child_name_1',
268268
help='The name of the database to be created when provisioning the database server. '
269269
'Database name must begin with a letter (a-z) or underscore (_). Subsequent characters '
270-
'in a name can be letters, digits (0-9), or underscores. Database name length must be less '
271-
'than 32 characters.',
270+
'in a name can be letters, digits (0-9), hyphens (-), or underscores. '
271+
'Database name length must be less than 64 characters.',
272272
local_context_attribute=LocalContextAttribute(
273273
name='database_name',
274274
actions=[LocalContextAction.SET],

src/azure-cli/azure/cli/command_modules/rdbms/validators.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ def validate_backup_name(backup_name):
986986

987987

988988
def validate_database_name(database_name):
989-
if database_name is not None and not re.match(r'^[a-zA-Z_][a-zA-Z0-9_]{0,30}$', database_name):
989+
if database_name is not None and not re.match(r'^[a-zA-Z_][\w\-]{0,62}$', database_name):
990990
raise ValidationError("Database name must begin with a letter (a-z) or underscore (_). "
991-
"Subsequent characters in a name can be letters, digits (0-9), or underscores. "
992-
"Database name length must be less than 32 characters.")
991+
"Subsequent characters in a name can be letters, digits (0-9), hyphens (-), "
992+
"or underscores. Database name length must be less than 64 characters.")

0 commit comments

Comments
 (0)