Commit 3a7601af authored by Matthieu Muffato's avatar Matthieu Muffato
Browse files

MySQL and PostgreSQL have a maximum length for database names

(resp 64 and 63 characters).
This simple patch prevents db_cmd from creating such databases with an
explicit message as opposite to the default MySQL error message:
"ERROR 1102 (42000) at line 1: Incorrect database name "
parent f883ccfc
......@@ -126,6 +126,10 @@ sub dbc_hash_to_cmd {
if($driver eq 'sqlite') {
return ['touch', $dbname];
} elsif(!$2) {
my %limits = ( 'mysql' => 64, 'pgsql' => 63 );
if (length($dbname) > $limits{$driver}) {
die "Database name '$dbname' is too long (> $limits{$driver}). Cannot create the database\n";
}
$sqlcmd = "$1 $dbname";
$dbc_hash->{dbname} = '';
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment