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
3 changes: 3 additions & 0 deletions go/vt/sqlparser/normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ func (nz *normalizer) WalkSelect(node SQLNode) (bool, error) {
// Common node types that never contain SQLVals or ListArgs but create a lot of object
// allocations.
return false, nil
case OrderBy, GroupBy:
// do not make a bind var for order by column_position
return false, nil
}
return true, nil
}
Expand Down
10 changes: 10 additions & 0 deletions go/vt/sqlparser/normalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ func TestNormalize(t *testing.T) {
in: "update a set v1 = b'11'",
outstmt: "update a set v1 = B'11'",
outbv: map[string]*querypb.BindVariable{},
}, {
// ORDER BY column_position
in: "select a, b from t order by 1 asc",
outstmt: "select a, b from t order by 1 asc",
outbv: map[string]*querypb.BindVariable{},
}, {
// ORDER BY variable
in: "select a, b from t order by c asc",
outstmt: "select a, b from t order by c asc",
outbv: map[string]*querypb.BindVariable{},
}, {
// Values up to len 256 will reuse.
in: fmt.Sprintf("select * from t where v1 = '%256s' and v2 = '%256s'", "a", "a"),
Expand Down