[MDEV-10481] Inconsistency between CREATE FUNCTION SYSDATE and DROP FUNCTION SYSDATE Created: 2016-08-02 Updated: 2018-08-27 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Parser |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compatibility | ||
| Issue Links: |
|
||||||||
| Description |
|
This query:
works normally and returns no errors. This query:
returns an error:
There is an inconsistency in here. The best solution is to make both queries work, as we generally allow to create stored functions that have the same names with built-in functions:
|
| Comments |
| Comment by Alexander Barkov [ 2016-08-02 ] | ||||||||||||||||
|
The same problem is repeatable for NOW and CURTIME. | ||||||||||||||||
| Comment by Alexander Barkov [ 2016-08-03 ] | ||||||||||||||||
|
The problem happens because the tokenizer in sql_lex.cc does this:
In case when SYSDATE is followed by parentheses, it returned as SYSDATE. Most of the functions listed in lex.h in the sql_functions[] array are also affected:
These functions from sql_functions[] are not affected (because they are listed in the "keyword_sp" rule):
| ||||||||||||||||
| Comment by Alexander Barkov [ 2018-06-15 ] | ||||||||||||||||
|
With sql_mode=ORACLE this script also fails:
While this script (with no parentheses after the function name) works fine:
|