Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

Bug: Mis-formatted error diagnostics for incorrect function use #665

Closed
creachadair opened this issue Apr 9, 2019 · 2 comments · Fixed by #666
Closed

Bug: Mis-formatted error diagnostics for incorrect function use #665

creachadair opened this issue Apr 9, 2019 · 2 comments · Fixed by #666
Assignees
Labels
bug Something isn't working documentation This is a documentation issue or pull request

Comments

@creachadair
Copy link

Repro:

$ srcd sql
mysql> select split("a,b", ",", 1);

Observed:

ERROR 1105 (HY000): unknown error: %!s(int=2): expecting 3 arguments for calling this function, %!d(MISSING) received

Expected:

  • Since it turns out that split only accepts two arguments, I would expect the diagnostic to report that 2 arguments are expected, not 3 (I assume the latter is because the implementation has a receiver or something hidden from the query API).

  • The error should not be classified as "unknown": It's either a syntax error or invalid parameters, but it is fully under the control of the CLI.

  • I expect the format strings to match their type, so that it says something like

    ERROR: split: expected 2 arguments, received 3.

    instead of having the auto-generated fallbacks from the fmt package like %!d(MISSING).

  • I expect the error string to mention the name of the function I got wrong. In this case it is obvious, but in a bigger query it would not be.

@kuba-- kuba-- self-assigned this Apr 10, 2019
@kuba-- kuba-- transferred this issue from src-d/gitbase Apr 10, 2019
@kuba-- kuba-- added bug Something isn't working documentation This is a documentation issue or pull request labels Apr 10, 2019
@kuba--
Copy link
Contributor

kuba-- commented Apr 10, 2019

ERROR 1105 (HY000): unknown error: comes from vitess.
We can fix invalid argument argument description as suggested .

@creachadair
Copy link
Author

creachadair commented Apr 11, 2019

🤘#666

Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working documentation This is a documentation issue or pull request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants