Skip to content

Commit

Permalink
No need to fail the whole query here
Browse files Browse the repository at this point in the history
Signed-off-by: Andres Taylor <andres@planetscale.com>
  • Loading branch information
systay committed Oct 15, 2020
1 parent b3cf183 commit 0287bc3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go/vt/vtgate/planbuilder/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ func (r *rewriter) rewriteTableSchema(cursor *sqlparser.Cursor) bool {

evalExpr, err := sqlparser.Convert(parent.Right)
if err != nil {
if err == sqlparser.ErrExprNotSupported {
// This just means we can't rewrite this particular expression,
// not that we have to exit altogether
return true
}
r.err = err
return false
}
Expand Down
17 changes: 17 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/from_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2115,3 +2115,20 @@
# non-existent table on right of join
"select c from user join t"
"table t not found"

# information schema query that uses table_schema
"select column_name from information_schema.columns where table_schema = (select schema())"
{
"QueryType": "SELECT",
"Original": "select column_name from information_schema.columns where table_schema = (select schema())",
"Instructions": {
"OperatorType": "Route",
"Variant": "SelectDBA",
"Keyspace": {
"Name": "main",
"Sharded": false
},
"FieldQuery": "select column_name from information_schema.`columns` where 1 != 1",
"Query": "select column_name from information_schema.`columns` where table_schema = schema()"
}
}

0 comments on commit 0287bc3

Please sign in to comment.