-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error for unsupported result type. #2585
Conversation
@@ -206,8 +206,10 @@ func (e Executor) execStmt(stmt parser.Statement, params parameters, planMaker * | |||
row.Values = append(row.Values, driver.Datum{ | |||
Payload: &driver.Datum_IntervalVal{IntervalVal: vt.Nanoseconds()}, | |||
}) | |||
case parser.DTuple: | |||
return fmt.Errorf("unsupported result type: tuple, remove extra parenthesis around column %s", result.Columns[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this advice is appropriate. other databases support the tuple return; it's fine that we do not, but this advice is inappropriate because it changes the semantics. The new verbiage in the default clause LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that the advice is inappropriate. I think we should have a specific error message for trying to return a tuple. Something like: "unsupported tuple result"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want folks to see parser.DTuple, and I much prefer having error messages provide guidance on what to do. Should I say "you might want to remove the extra..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivekmenezes you can get "tuple" instead of "parser.DTuple" by calling Type()
on the datum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it to what Tamir suggests. You are sure you don't want the recommendation "you might want to remove..." right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I suppose with "tuple" it's probably good enough. Changing
1739505
to
f3613d7
Compare
LGTM |
Improve error for unsupported result type.
No description provided.