PL/SQL parser - Phase 2
(MDEV-10764)
|
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Parser |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Technical task | Priority: | Minor |
| Reporter: | Alexander Barkov | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 2 |
| Labels: | Compatibility, Oracle | ||
| Issue Links: |
|
||||||||
| Description |
|
Oracle uses the SQL standard syntax for simple comments: dash-dash starts a comment, the rest of the line is a comment.
MariaDB uses non-standard syntaxt: dash-dash-space starts a comment. This is an example of a valid script:
If I remove the space character after "--", it returns a syntax error:
That was an intentional design in early MySQL versions: We should add an option to make dash-dash without an extra space start a comment, as it makes migration from Oracle difficult. Perhaps, a new flag in sql_mode or old_mode can solve the issue. |
| Comments |
| Comment by Sergei Golubchik [ 2019-06-11 ] |
|
dash-dash with no space is the sql standard syntax, MariaDB should support it not only in the ORACLE mode. |
| Comment by Sergei Golubchik [ 2019-06-12 ] |
|
The problem comes from the syntax like SELECT --1 — this is valid both in MariaDB and Oracle, and means SELECT 1. But in the standard SQL -- starts a comment, the standard does not allow more than one <minus sign> before a number (so it seems). I don't think we can implement the standard behavior, it'll be a pretty serious compatibility break. |