Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.6, 10.11, 11.1(EOL), 11.2, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 11.0(EOL)
Description
This script:
CREATE OR REPLACE FUNCTION empty(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0; |
SELECT empty('1'); |
used to work without any unexpected side effects prior to 10.6:
MariaDB [test]> CREATE OR REPLACE FUNCTION empty(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0; |
Query OK, 0 rows affected (0.007 sec) |
 |
MariaDB [test]> SELECT empty('1'); |
+------------+ |
| empty('1') | |
+------------+ |
| 0 |
|
+------------+ |
1 row in set (0.002 sec) |
Starting from 10.6, behavior changed:
The CREATE statement now raises a warnings:
CREATE OR REPLACE FUNCTION empty(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0; |
SHOW WARNINGS;
|
+-------+------+--------------------------------------------------------------+
|
| Level | Code | Message |
|
+-------+------+--------------------------------------------------------------+
|
| Note | 1585 | This function 'empty' has the same name as a native function |
|
+-------+------+--------------------------------------------------------------+
|
The warning is not correct. 'empty' is not a native function! It's only a new 10.6 non-reserved keyword. There should not be any warnings.
The SELECT statement now raises a syntax error:
SELECT empty('1'); |
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '('1')' at line 1
|
This is wrong. No errors expected.
These behavior changes raise problems on upgrade.
The problem was caused by MDEV-17399.
Other keywords added in MDEV-17399 should also be checked for the same problem:
+%token <kwd> EMPTY_SYM /* SQL-2016-R */ |
+%token <rwd> JSON_TABLE_SYM
|
+%token <kwd> NESTED_SYM /* SQL-2003-N */ |
+%token <kwd> ORDINALITY_SYM /* SQL-2003-N */ |
+%token <kwd> PATH_SYM /* SQL-2003-N */ |
Attachments
Issue Links
- is caused by
-
MDEV-17399 Add support for JSON_TABLE
- Closed
- relates to
-
MDEV-28248 Wrong note "function .. has the same name..." on a general keyword
- Open