diff --git a/go/vt/sqlparser/sql.go b/go/vt/sqlparser/sql.go index fefff2361e7..3e801c79658 100644 --- a/go/vt/sqlparser/sql.go +++ b/go/vt/sqlparser/sql.go @@ -13470,7 +13470,7 @@ yydefault: var yyLOCAL *TableOption //line sql.y:2829 { - yyLOCAL = &TableOption{Name: string(yyDollar[1].str), String: (yyDollar[3].identifierCI.String() + yyDollar[4].str)} + yyLOCAL = &TableOption{Name: string(yyDollar[1].str), String: (yyDollar[3].identifierCI.String() + yyDollar[4].str), CaseSensitive: true} } yyVAL.union = yyLOCAL case 495: diff --git a/go/vt/sqlparser/sql.y b/go/vt/sqlparser/sql.y index a8160c3d463..7c7c2b1a85b 100644 --- a/go/vt/sqlparser/sql.y +++ b/go/vt/sqlparser/sql.y @@ -2827,7 +2827,7 @@ table_option: } | TABLESPACE equal_opt sql_id storage_opt { - $$ = &TableOption{Name:string($1), String: ($3.String() + $4)} + $$ = &TableOption{Name:string($1), String: ($3.String() + $4), CaseSensitive: true} } | UNION equal_opt '(' table_name_list ')' { diff --git a/go/vt/sqlparser/tracked_buffer_test.go b/go/vt/sqlparser/tracked_buffer_test.go index af1de7c843e..6924bf11911 100644 --- a/go/vt/sqlparser/tracked_buffer_test.go +++ b/go/vt/sqlparser/tracked_buffer_test.go @@ -104,6 +104,10 @@ func TestCanonicalOutput(t *testing.T) { "create table a (v varchar(32)) engine=InnoDB", "CREATE TABLE `a` (\n\t`v` varchar(32)\n) ENGINE InnoDB", }, + { // tablespace names are case-sensitive: https://dev.mysql.com/doc/refman/en/general-tablespaces.html + "create table a (v varchar(32)) engine=InnoDB tablespace innodb_system", + "CREATE TABLE `a` (\n\t`v` varchar(32)\n) ENGINE InnoDB,\n TABLESPACE innodb_system", + }, { "create table a (id int not null primary key) engine InnoDB, charset utf8mb4, collate utf8mb4_0900_ai_ci partition by range (`id`) (partition `p10` values less than(10) engine InnoDB tablespace foo)", "CREATE TABLE `a` (\n\t`id` int NOT NULL PRIMARY KEY\n) ENGINE InnoDB,\n CHARSET utf8mb4,\n COLLATE utf8mb4_0900_ai_ci\nPARTITION BY RANGE (`id`)\n(PARTITION `p10` VALUES LESS THAN (10) ENGINE InnoDB TABLESPACE foo)",