Skip to content
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

Allow non-reserved-keywords for index names #15602

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,24 @@ var (
}, {
input: "alter schema d collate = 'utf8_bin' character set = geostd8 character set = geostd8",
output: "alter database d collate 'utf8_bin' character set geostd8 character set geostd8",
}, {
input: `DROP INDEX Indexes ON mydb.mytable`,
output: "alter table mydb.mytable drop key `Indexes`",
}, {
input: `create index Indexes on b (col1)`,
output: "alter table b add key `Indexes` (col1)",
}, {
input: `create fulltext index Indexes on b (col1)`,
output: "alter table b add fulltext key `Indexes` (col1)",
}, {
input: `create spatial index Indexes on b (col1)`,
output: "alter table b add spatial key `Indexes` (col1)",
}, {
input: "alter table a alter index indexes visible, alter index indexes invisible",
output: "alter table a alter index `indexes` visible, alter index `indexes` invisible",
}, {
input: "alter table a add spatial key indexes (column1)",
output: "alter table a add spatial key `indexes` (column1)",
}, {
input: "create table a",
partialDDL: true,
Expand Down Expand Up @@ -4764,6 +4782,7 @@ func TestCreateTable(t *testing.T) {
primary key (id),
spatial key geom (geom),
fulltext key fts (full_name),
fulltext key indexes (full_name),
unique key by_username (username),
unique key by_username2 (username),
unique key by_username3 (username),
Expand All @@ -4780,6 +4799,7 @@ func TestCreateTable(t *testing.T) {
primary key (id),
spatial key geom (geom),
fulltext key fts (full_name),
fulltext key ` + "`indexes`" + ` (full_name),
unique key by_username (username),
unique key by_username2 (username),
unique key by_username3 (username),
Expand Down Expand Up @@ -4964,6 +4984,7 @@ func TestCreateTable(t *testing.T) {
primary key (id, username),
key by_email (email(10), username),
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b),
constraint indexes foreign key (k, j) references t2 (a, b),
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b) on delete restrict,
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b) on delete no action,
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b) on delete cascade on update set default,
Expand Down Expand Up @@ -5000,6 +5021,7 @@ func TestCreateTable(t *testing.T) {
primary key (id, username),
key by_email (email(10), username),
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b),
constraint ` + "`indexes`" + ` foreign key (k, j) references t2 (a, b),
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b) on delete restrict,
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b) on delete no action,
constraint second_ibfk_1 foreign key (k, j) references t2 (a, b) on delete cascade on update set default,
Expand Down
Loading
Loading