[MDEV-9166] Wrong error message and shift/reduce conflicts in the RETURNS clause Created: 2015-11-23 Updated: 2016-03-02 Resolved: 2015-11-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Parser |
| Affects Version/s: | None |
| Fix Version/s: | 10.2.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | 10.2.0-1 |
| Description |
|
There is a shift/reduce conflict in the grammar in sql_yacc.yy when parsing a query like this:
The parser does not know what the left parenthesis means, either it continues the data type specifying the length:
or it's a CHAR with no length (i.e. length==1) followed by a start of a subselect:
Note, the latter query is accepted by the parse, but it's syntactically is wrong. A correct query would be:
Fortunately, currently the wrong query returns an error anyway:
But it should be fixed to return a syntax error instead, because the RETURN keyword is obviously missing. An idea for a fix: The sp_proc_stmt rule in sql_yacc.yy should be split into two parts: This will fix the error message, as well as remove some shift/reduce conflicts. |