Skip to content
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 reporting in SQL #3036

Closed
kyukhin opened this issue Jan 10, 2018 · 1 comment
Closed

Improve error reporting in SQL #3036

kyukhin opened this issue Jan 10, 2018 · 1 comment
Assignees
Labels
refactoring Code refactoring sql
Milestone

Comments

@kyukhin
Copy link
Contributor

kyukhin commented Jan 10, 2018

Here is an example w/ nasty error message.
Testcase:

$ cat 1.lua
box.cfg{wal_mode='none'}
box.sql.execute([[CREATE TABLE t (a INTEGER primary key, b INTEGER NOT NULL]])

Error produced:

2018-01-10 16:55:30.198 [26365] main/101/1.lua F> keyword "NULL" is reserved`

(error is that closing brace is missing)

@kyukhin kyukhin added the sql label Jan 10, 2018
@TheAviat0r
Copy link
Contributor

Key problem is that we have syntax error and fallback error.

Fallback is when you use keyword in not appropriate place, for example you can execute next statement:

CREATE TABLE ABORT(a int primary key);

We have "ABORT" keyword with token type TK_ABORT, we have fallback rule in parse.y which says to fallback TK_ABORT to TK_ID (identifier token type), therefore error doesn't happen. If you try something else without fallback rule, you will get an error.

Key of the problem is that parser doesn't separate fallback errors and syntax errors, handling of that situation now is being done in the same parser state. If both happens and last processed keyword is reserved, we will see message 'keyword "KEYWORD" is reserved" like in the example above, not 'syntax error ... '.

We need to implement %fallback_error clause for lemon and to distinct fallback error and syntax error and to make syntax error priority higher.

@kostja kostja added this to the wishlist milestone Feb 7, 2018
@kostja kostja added the feature A new functionality label Feb 13, 2018
@kyukhin kyukhin modified the milestones: wishlist, 2.1.1 Feb 5, 2019
@kyukhin kyukhin added refactoring Code refactoring and removed feature A new functionality labels Feb 11, 2019
ImeevMA added a commit that referenced this issue Mar 13, 2019
This patch completely replaces sqlErrorMsg() with diag_set() and
removes sqlErrorMsg().

Closes #3965
Closes #3036
ImeevMA added a commit that referenced this issue Mar 13, 2019
This patch completely replaces sqlErrorMsg() with diag_set() and
removes sqlErrorMsg().

Closes #3965
Closes #3036
ImeevMA added a commit that referenced this issue Mar 25, 2019
This patch completely replaces sqlErrorMsg() with diag_set() and
removes sqlErrorMsg().

Closes #3965
Closes #3036
ImeevMA added a commit that referenced this issue Mar 26, 2019
This patch completely replaces sqlErrorMsg() with diag_set() and
removes sqlErrorMsg().

Closes #3965
Closes #3036
ImeevMA added a commit that referenced this issue Mar 26, 2019
This patch completely replaces sqlErrorMsg() with diag_set() and
removes sqlErrorMsg().

Closes #3965
Closes #3036
kyukhin pushed a commit that referenced this issue Mar 27, 2019
This patch completely replaces sqlErrorMsg() with diag_set() and
removes sqlErrorMsg().

Closes #3965
Closes #3036

(cherry picked from commit 4e486f3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactoring sql
Projects
None yet
Development

No branches or pull requests

4 participants