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: 4 additions & 0 deletions data/test/vtgate/dml_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1015,6 +1015,10 @@
}
}

# insert into a vindex not allowed
"insert into user_index(id) values(1)"
"inserting into a vindex not allowed: user_index"

# simple replace unsharded
"replace into unsharded values(1, 2)"
{
Expand Down
6 changes: 3 additions & 3 deletions data/test/vtgate/unsupported_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@

# multi delete multi table
"delete user from user join user_extra on user.id = user_extra.id where user.name = 'foo'"
"unsupported: multi-table delete statement in sharded keyspace"
"unsupported: multi-table/vindex delete statement in sharded keyspace"

# scatter delete with owned lookup vindex
"delete from user"
Expand Down Expand Up @@ -289,11 +289,11 @@

# join in update tables
"update user join user_extra on user.id = user_extra.id set user.name = 'foo'"
"unsupported: multi-table update statement in sharded keyspace"
"unsupported: multi-table/vindex update statement in sharded keyspace"

# multiple tables in update
"update user as u, user_extra as ue set u.name = 'foo' where u.id = ue.id"
"unsupported: multi-table update statement in sharded keyspace"
"unsupported: multi-table/vindex update statement in sharded keyspace"

# unsharded insert with cross-shard join"
"insert into unsharded select u.col from user u join user u1"
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func buildDeletePlan(del *sqlparser.Delete, vschema ContextVSchema) (*engine.Del
}
rb, ok := pb.bldr.(*route)
if !ok {
return nil, errors.New("unsupported: multi-table delete statement in sharded keyspace")
return nil, errors.New("unsupported: multi-table/vindex delete statement in sharded keyspace")
}
edel.Keyspace = rb.ERoute.Keyspace
if !edel.Keyspace.Sharded {
Expand Down
7 changes: 5 additions & 2 deletions go/vt/vtgate/planbuilder/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ func buildInsertPlan(ins *sqlparser.Insert, vschema ContextVSchema) (*engine.Ins
if err := pb.processAliasedTable(aliased); err != nil {
return nil, err
}
// route is guaranteed because of simple table expr.
rb := pb.bldr.(*route)
rb, ok := pb.bldr.(*route)
if !ok {
// This can happen only for vindexes right now.
return nil, fmt.Errorf("inserting into a vindex not allowed: %s", sqlparser.String(ins.Table))
}
if rb.ERoute.TargetDestination != nil {
return nil, errors.New("unsupported: INSERT with a target destination")
}
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/planbuilder/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func buildUpdatePlan(upd *sqlparser.Update, vschema ContextVSchema) (*engine.Upd
}
rb, ok := pb.bldr.(*route)
if !ok {
return nil, errors.New("unsupported: multi-table update statement in sharded keyspace")
return nil, errors.New("unsupported: multi-table/vindex update statement in sharded keyspace")
}
if rb.ERoute.TargetDestination != nil {
return nil, errors.New("unsupported: UPDATE with a target destination")
Expand Down