Skip to content
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
4 changes: 2 additions & 2 deletions go/vt/sqlparser/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,9 @@ func (node *DDL) Format(buf *TrackedBuffer) {
case FlushStr:
buf.Myprintf("%s", node.Action)
case CreateVindexStr:
buf.Myprintf("alter vschema create vindex %v %v", node.VindexSpec.Name, node.VindexSpec)
buf.Myprintf("alter vschema create vindex %v %v", node.Table, node.VindexSpec)
case DropVindexStr:
buf.Myprintf("alter vschema drop vindex %v", node.VindexSpec.Name)
buf.Myprintf("alter vschema drop vindex %v", node.Table)
case AddVschemaTableStr:
buf.Myprintf("alter vschema add table %v", node.Table)
case DropVschemaTableStr:
Expand Down
19 changes: 19 additions & 0 deletions go/vt/sqlparser/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,25 +971,42 @@ var (
output: "create table a (\n\tb1 bool not null primary key,\n\tb2 boolean not null\n)",
}, {
input: "alter vschema create vindex hash_vdx using hash",
}, {
input: "alter vschema create vindex keyspace.hash_vdx using hash",
}, {
input: "alter vschema create vindex lookup_vdx using lookup with owner=user, table=name_user_idx, from=name, to=user_id",
}, {
input: "alter vschema create vindex xyz_vdx using xyz with param1=hello, param2='world', param3=123",
}, {
input: "alter vschema drop vindex hash_vdx",
}, {
input: "alter vschema drop vindex ks.hash_vdx",
}, {
input: "alter vschema add table a",
}, {
input: "alter vschema add table ks.a",
}, {
input: "alter vschema add sequence a_seq",
}, {
input: "alter vschema add sequence ks.a_seq",
}, {
input: "alter vschema on a add auto_increment id using a_seq",
}, {
input: "alter vschema on ks.a add auto_increment id using a_seq",
}, {
input: "alter vschema drop table a",
}, {
input: "alter vschema drop table ks.a",
}, {
input: "alter vschema on a add vindex hash (id)",
}, {
input: "alter vschema on ks.a add vindex hash (id)",
}, {
input: "alter vschema on a add vindex `hash` (`id`)",
output: "alter vschema on a add vindex hash (id)",
}, {
input: "alter vschema on `ks`.a add vindex `hash` (`id`)",
output: "alter vschema on ks.a add vindex hash (id)",
}, {
input: "alter vschema on a add vindex hash (id) using `hash`",
output: "alter vschema on a add vindex hash (id) using hash",
Expand All @@ -1007,6 +1024,8 @@ var (
output: "alter vschema on user2 add vindex name_lastname_lookup_vdx (name, lastname) using lookup with owner=user, table=name_lastname_keyspace_id_map, from=name,lastname, to=keyspace_id",
}, {
input: "alter vschema on a drop vindex hash",
}, {
input: "alter vschema on ks.a drop vindex hash",
}, {
input: "alter vschema on a drop vindex `hash`",
output: "alter vschema on a drop vindex hash",
Expand Down
Loading