Skip to content

Commit

Permalink
sqlparser: Tablespace option is case sensitive (#13884)
Browse files Browse the repository at this point in the history
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
  • Loading branch information
dbussink authored Aug 30, 2023
1 parent 99271d4 commit ce389fa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go/vt/sqlparser/sql.y
Original file line number Diff line number Diff line change
Expand Up @@ -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 ')'
{
Expand Down
4 changes: 4 additions & 0 deletions go/vt/sqlparser/tracked_buffer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down

0 comments on commit ce389fa

Please sign in to comment.