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
2 changes: 1 addition & 1 deletion data/test/tabletserver/exec_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
{
"PlanID": "PASS_SELECT",
"TableName": "",
"FieldQuery": "select * from a right join b on 1 != 1 where 1 != 1",
"FieldQuery": "select * from a right join b on c = d where 1 != 1",
"FullQuery": "select * from a right join b on c = d limit :#maxLimit"
}

Expand Down
10 changes: 5 additions & 5 deletions data/test/vtgate/filter_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
"Sharded": true
},
"Query": "select user_extra.id from user join user_extra on user.id = user_extra.user_id where user.id = 5",
"FieldQuery": "select user_extra.id from user join user_extra where 1 != 1",
"FieldQuery": "select user_extra.id from user join user_extra on user.id = user_extra.user_id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand All @@ -193,7 +193,7 @@
"Sharded": true
},
"Query": "select user_extra.id from user join user_extra on user.id = user_extra.user_id where user_extra.user_id = 5",
"FieldQuery": "select user_extra.id from user join user_extra where 1 != 1",
"FieldQuery": "select user_extra.id from user join user_extra on user.id = user_extra.user_id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand All @@ -210,7 +210,7 @@
"Sharded": true
},
"Query": "select user_extra.id from user left join user_extra on user.id = user_extra.user_id where user.id = 5",
"FieldQuery": "select user_extra.id from user left join user_extra on 1 != 1 where 1 != 1",
"FieldQuery": "select user_extra.id from user left join user_extra on user.id = user_extra.user_id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand All @@ -227,7 +227,7 @@
"Sharded": true
},
"Query": "select user_extra.id from user left join user_extra on user.id = user_extra.user_id where user_extra.user_id = 5",
"FieldQuery": "select user_extra.id from user left join user_extra on 1 != 1 where 1 != 1"
"FieldQuery": "select user_extra.id from user left join user_extra on user.id = user_extra.user_id where 1 != 1"
}
}

Expand Down Expand Up @@ -715,7 +715,7 @@
"Sharded": true
},
"Query": "select user_extra.Id from user join user_extra on user.iD = user_extra.User_Id where user.Id = 5",
"FieldQuery": "select user_extra.Id from user join user_extra where 1 != 1",
"FieldQuery": "select user_extra.Id from user join user_extra on user.iD = user_extra.User_Id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand Down
22 changes: 11 additions & 11 deletions data/test/vtgate/from_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"Sharded": false
},
"Query": "select m1.col from unsharded as m1 left join unsharded as m2 on m1.a = m2.b",
"FieldQuery": "select m1.col from unsharded as m1 left join unsharded as m2 on 1 != 1 where 1 != 1"
"FieldQuery": "select m1.col from unsharded as m1 left join unsharded as m2 on m1.a = m2.b where 1 != 1"
}
}

Expand Down Expand Up @@ -307,7 +307,7 @@
"Sharded": false
},
"Query": "select m1.col from unsharded as m2 left join unsharded as m1 on m1.a = m2.b",
"FieldQuery": "select m1.col from unsharded as m2 left join unsharded as m1 on 1 != 1 where 1 != 1"
"FieldQuery": "select m1.col from unsharded as m2 left join unsharded as m1 on m1.a = m2.b where 1 != 1"
}
}

Expand All @@ -322,7 +322,7 @@
"Sharded": false
},
"Query": "select m1.col from unsharded as m3 left join (unsharded as m1 join unsharded as m2) on m1.a = m2.b",
"FieldQuery": "select m1.col from unsharded as m3 left join (unsharded as m1 join unsharded as m2) on 1 != 1 where 1 != 1"
"FieldQuery": "select m1.col from unsharded as m3 left join (unsharded as m1 join unsharded as m2) on m1.a = m2.b where 1 != 1"
}
}

Expand Down Expand Up @@ -484,7 +484,7 @@
"Sharded": true
},
"Query": "select user.col from user join user_extra on user.id = user_extra.user_id",
"FieldQuery": "select user.col from user join user_extra where 1 != 1"
"FieldQuery": "select user.col from user join user_extra on user.id = user_extra.user_id where 1 != 1"
}
}

Expand All @@ -499,7 +499,7 @@
"Sharded": true
},
"Query": "select user.col from user join user_extra on user.col between 1 and 2 and user.id = user_extra.user_id",
"FieldQuery": "select user.col from user join user_extra where 1 != 1"
"FieldQuery": "select user.col from user join user_extra on user.col between 1 and 2 and user.id = user_extra.user_id where 1 != 1"
}
}

Expand All @@ -514,7 +514,7 @@
"Sharded": true
},
"Query": "select user.col from user join user_extra on user_extra.user_id = user.id",
"FieldQuery": "select user.col from user join user_extra where 1 != 1"
"FieldQuery": "select user.col from user join user_extra on user_extra.user_id = user.id where 1 != 1"
}
}

Expand All @@ -529,7 +529,7 @@
"Sharded": true
},
"Query": "select user.col from user join user_extra on user.id = 5 and user.id = user_extra.user_id",
"FieldQuery": "select user.col from user join user_extra where 1 != 1",
"FieldQuery": "select user.col from user join user_extra on user.id = 5 and user.id = user_extra.user_id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand Down Expand Up @@ -737,7 +737,7 @@
"Sharded": true
},
"Query": "select t.id from (select id from user where id = 5) as t join user_extra on t.id = user_extra.user_id",
"FieldQuery": "select t.id from (select id from user where 1 != 1) as t join user_extra where 1 != 1",
"FieldQuery": "select t.id from (select id from user where 1 != 1) as t join user_extra on t.id = user_extra.user_id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand All @@ -754,7 +754,7 @@
"Sharded": true
},
"Query": "select t.id from (select user.id from user where user.id = 5) as t join user_extra on t.id = user_extra.user_id",
"FieldQuery": "select t.id from (select user.id from user where 1 != 1) as t join user_extra where 1 != 1",
"FieldQuery": "select t.id from (select user.id from user where 1 != 1) as t join user_extra on t.id = user_extra.user_id where 1 != 1",
"Vindex": "user_index",
"Values": 5
}
Expand All @@ -775,7 +775,7 @@
"Sharded": true
},
"Query": "select t.id from user_extra join (select id from user where id = 5) as t on t.id = user_extra.user_id",
"FieldQuery": "select t.id from user_extra join (select id from user where 1 != 1) as t where 1 != 1"
"FieldQuery": "select t.id from user_extra join (select id from user where 1 != 1) as t on t.id = user_extra.user_id where 1 != 1"
}
}

Expand Down Expand Up @@ -897,7 +897,7 @@
"Sharded": true
},
"Query": "select user.col from user join user_extra on user.ID = user_extra.User_Id",
"FieldQuery": "select user.col from user join user_extra where 1 != 1"
"FieldQuery": "select user.col from user join user_extra on user.ID = user_extra.User_Id where 1 != 1"
}
}

Expand Down
7 changes: 0 additions & 7 deletions go/vt/sqlparser/impossible_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ func FormatImpossibleQuery(buf *TrackedBuffer, node SQLNode) {
if node.GroupBy != nil {
node.GroupBy.Format(buf)
}
case *JoinTableExpr:
if node.Join == LeftJoinStr || node.Join == RightJoinStr {
// ON clause is requried
buf.Myprintf("%v %s %v on 1 != 1", node.LeftExpr, node.Join, node.RightExpr)
} else {
buf.Myprintf("%v %s %v", node.LeftExpr, node.Join, node.RightExpr)
}
default:
node.Format(buf)
}
Expand Down
10 changes: 5 additions & 5 deletions go/vt/tabletserver/endtoend/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestNocacheCases(t *testing.T) {
{"1", "2", "1", "2"},
},
Rewritten: []string{
"select a.eid, a.id, b.eid, b.id from vitess_a as a join vitess_b as b where 1 != 1",
"select a.eid, a.id, b.eid, b.id from vitess_a as a join vitess_b as b on a.eid = b.eid and a.id = b.id where 1 != 1",
"select /* join */ a.eid, a.id, b.eid, b.id from vitess_a as a join vitess_b as b on a.eid = b.eid and a.id = b.id limit 10001",
},
RowsAffected: 2,
Expand All @@ -161,7 +161,7 @@ func TestNocacheCases(t *testing.T) {
{"1", "2", "1", "2"},
},
Rewritten: []string{
"select a.eid, a.id, b.eid, b.id from vitess_a as a straight_join vitess_b as b where 1 != 1",
"select a.eid, a.id, b.eid, b.id from vitess_a as a straight_join vitess_b as b on a.eid = b.eid and a.id = b.id where 1 != 1",
"select /* straight_join */ a.eid, a.id, b.eid, b.id from vitess_a as a straight_join vitess_b as b on a.eid = b.eid and a.id = b.id limit 10001",
},
RowsAffected: 2,
Expand All @@ -174,7 +174,7 @@ func TestNocacheCases(t *testing.T) {
{"1", "2", "1", "2"},
},
Rewritten: []string{
"select a.eid, a.id, b.eid, b.id from vitess_a as a join vitess_b as b where 1 != 1",
"select a.eid, a.id, b.eid, b.id from vitess_a as a join vitess_b as b on a.eid = b.eid and a.id = b.id where 1 != 1",
"select /* cross join */ a.eid, a.id, b.eid, b.id from vitess_a as a join vitess_b as b on a.eid = b.eid and a.id = b.id limit 10001",
},
RowsAffected: 2,
Expand All @@ -200,7 +200,7 @@ func TestNocacheCases(t *testing.T) {
{"1", "2", "1", "2"},
},
Rewritten: []string{
"select a.eid, a.id, b.eid, b.id from vitess_a as a left join vitess_b as b on 1 != 1 where 1 != 1",
"select a.eid, a.id, b.eid, b.id from vitess_a as a left join vitess_b as b on a.eid = b.eid and a.id = b.id where 1 != 1",
"select /* left join */ a.eid, a.id, b.eid, b.id from vitess_a as a left join vitess_b as b on a.eid = b.eid and a.id = b.id limit 10001",
},
RowsAffected: 2,
Expand All @@ -213,7 +213,7 @@ func TestNocacheCases(t *testing.T) {
{"1", "2", "1", "2"},
},
Rewritten: []string{
"select a.eid, a.id, b.eid, b.id from vitess_a as a right join vitess_b as b on 1 != 1 where 1 != 1",
"select a.eid, a.id, b.eid, b.id from vitess_a as a right join vitess_b as b on a.eid = b.eid and a.id = b.id where 1 != 1",
"select /* right join */ a.eid, a.id, b.eid, b.id from vitess_a as a right join vitess_b as b on a.eid = b.eid and a.id = b.id limit 10001",
},
RowsAffected: 2,
Expand Down