Commit 10d44db5 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-16202 Latest changes made erroneously some keywords reserved in sql_mode=ORACLE

parent 21b12e33
This diff is collapsed.
...@@ -1379,3 +1379,67 @@ BEGIN NOT ATOMIC ...@@ -1379,3 +1379,67 @@ BEGIN NOT ATOMIC
END; END;
$$ $$
DELIMITER ;$$ DELIMITER ;$$
--echo #
--echo # MDEV-16202 Latest changes made erroneously some keywords reserved in sql_mode=ORACLE
--echo #
DELIMITER $$;
CREATE PROCEDURE p1(name VARCHAR(64), pattern TEXT)
BEGIN
DECLARE query TEXT DEFAULT REPLACE(pattern, 'name', name);
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
SHOW ERRORS;
END;
SELECT query AS '';
EXECUTE IMMEDIATE query;
END;
$$
CREATE PROCEDURE p2(name VARCHAR(64))
BEGIN
CALL p1(name, 'BEGIN NOT ATOMIC DECLARE name INT; SET name=10; SELECT name; END');
EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (name INT)', 'name', name);
CALL p1(name, 'SELECT name FROM t1');
CALL p1(name, 'SELECT name ''alias'' FROM t1');
CALL p1(name, 'SELECT name()');
CALL p1(name, 'SELECT name.name()');
CALL p1(name, 'SELECT name DATE FROM t1');
CALL p1(name, 'SELECT name HISTORY FROM t1');
CALL p1(name, 'SELECT name NEXT FROM t1');
CALL p1(name, 'SELECT name PERIOD FROM t1');
CALL p1(name, 'SELECT name PREVIOUS FROM t1');
CALL p1(name, 'SELECT name SYSTEM FROM t1');
CALL p1(name, 'SELECT name SYSTEM_TIME FROM t1');
CALL p1(name, 'SELECT name TIME FROM t1');
CALL p1(name, 'SELECT name TIMESTAMP FROM t1');
CALL p1(name, 'SELECT name TRANSACTION FROM t1');
CALL p1(name, 'SELECT name VALUE FROM t1');
CALL p1(name, 'SELECT name VERSIONING FROM t1');
CALL p1(name, 'SELECT name WITHOUT FROM t1');
DROP TABLE t1;
END;
$$
DELIMITER ;$$
--disable_column_names
CALL p2('date');
CALL p2('history');
CALL p2('next');
CALL p2('period');
CALL p2('previous');
CALL p2('system');
CALL p2('system_time');
CALL p2('time');
CALL p2('timestamp');
CALL p2('transaction');
CALL p2('value');
CALL p2('versioning');
CALL p2('without');
--enable_column_names
DROP PROCEDURE p2;
DROP PROCEDURE p1;
...@@ -22,3 +22,68 @@ BEGIN ...@@ -22,3 +22,68 @@ BEGIN
END; END;
$$ $$
DELIMITER ;$$ DELIMITER ;$$
--echo #
--echo # MDEV-16202 Latest changes made erroneously some keywords reserved in sql_mode=ORACLE
--echo #
DELIMITER $$;
CREATE PROCEDURE p1(name VARCHAR(64), pattern TEXT) AS
query TEXT DEFAULT REPLACE(pattern, 'name', name);
BEGIN
SELECT query AS '';
EXECUTE IMMEDIATE query;
EXCEPTION
WHEN OTHERS THEN
BEGIN
SHOW ERRORS;
END;
END;
$$
CREATE PROCEDURE p2(name VARCHAR(64)) AS
BEGIN
CALL p1(name, 'DECLARE name INT; BEGIN name:=10; SELECT name; END');
EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (name INT)', 'name', name);
CALL p1(name, 'SELECT name FROM t1');
CALL p1(name, 'SELECT name ''alias'' FROM t1');
CALL p1(name, 'SELECT name()');
CALL p1(name, 'SELECT name.name()');
CALL p1(name, 'SELECT name DATE FROM t1');
CALL p1(name, 'SELECT name HISTORY FROM t1');
CALL p1(name, 'SELECT name NEXT FROM t1');
CALL p1(name, 'SELECT name PERIOD FROM t1');
CALL p1(name, 'SELECT name PREVIOUS FROM t1');
CALL p1(name, 'SELECT name SYSTEM FROM t1');
CALL p1(name, 'SELECT name SYSTEM_TIME FROM t1');
CALL p1(name, 'SELECT name TIME FROM t1');
CALL p1(name, 'SELECT name TIMESTAMP FROM t1');
CALL p1(name, 'SELECT name TRANSACTION FROM t1');
CALL p1(name, 'SELECT name VALUE FROM t1');
CALL p1(name, 'SELECT name VERSIONING FROM t1');
CALL p1(name, 'SELECT name WITHOUT FROM t1');
DROP TABLE t1;
END;
$$
DELIMITER ;$$
--disable_column_names
CALL p2('date');
CALL p2('history');
CALL p2('next');
CALL p2('period');
CALL p2('previous');
CALL p2('system');
CALL p2('system_time');
CALL p2('time');
CALL p2('timestamp');
CALL p2('transaction');
CALL p2('value');
CALL p2('versioning');
CALL p2('without');
--enable_column_names
DROP PROCEDURE p2;
DROP PROCEDURE p1;
...@@ -1220,17 +1220,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1220,17 +1220,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> COMMENT_SYM %token <kwd> COMMENT_SYM
%token <kwd> ELSIF_SYM /* Oracle, reserved in PL/SQL*/ %token <kwd> ELSIF_SYM /* Oracle, reserved in PL/SQL*/
%token <kwd> GOTO_SYM /* Oracle, reserved in PL/SQL*/ %token <kwd> GOTO_SYM /* Oracle, reserved in PL/SQL*/
%token <kwd> HISTORY_SYM /* MYSQL */
%token <kwd> OTHERS_SYM /* SQL-2011-N */ %token <kwd> OTHERS_SYM /* SQL-2011-N */
%token <kwd> PACKAGE_SYM /* Oracle-R */ %token <kwd> PACKAGE_SYM /* Oracle-R */
%token <kwd> PERIOD_SYM /* SQL-2011-R */
%token <kwd> RAISE_SYM /* Oracle-PLSQL-R */ %token <kwd> RAISE_SYM /* Oracle-PLSQL-R */
%token <kwd> ROWTYPE_SYM /* Oracle-PLSQL-R */ %token <kwd> ROWTYPE_SYM /* Oracle-PLSQL-R */
%token <kwd> SYSTEM /* SQL-2011-R */
%token <kwd> SYSTEM_TIME_SYM /* SQL-2011-R */
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> WINDOW_SYM %token <kwd> WINDOW_SYM
%token <kwd> WITHOUT /* SQL-2003-R */
/* /*
Non-reserved keywords Non-reserved keywords
...@@ -1376,6 +1370,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1376,6 +1370,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> HASH_SYM %token <kwd> HASH_SYM
%token <kwd> HELP_SYM %token <kwd> HELP_SYM
%token <kwd> HIGH_PRIORITY %token <kwd> HIGH_PRIORITY
%token <kwd> HISTORY_SYM /* MYSQL */
%token <kwd> HOST_SYM %token <kwd> HOST_SYM
%token <kwd> HOSTS_SYM %token <kwd> HOSTS_SYM
%token <kwd> HOUR_SYM /* SQL-2003-R */ %token <kwd> HOUR_SYM /* SQL-2003-R */
...@@ -1493,6 +1488,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1493,6 +1488,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PARTITIONS_SYM %token <kwd> PARTITIONS_SYM
%token <kwd> PARTITIONING_SYM %token <kwd> PARTITIONING_SYM
%token <kwd> PASSWORD_SYM %token <kwd> PASSWORD_SYM
%token <kwd> PERIOD_SYM /* SQL-2011-R */
%token <kwd> PERSISTENT_SYM %token <kwd> PERSISTENT_SYM
%token <kwd> PHASE_SYM %token <kwd> PHASE_SYM
%token <kwd> PLUGINS_SYM %token <kwd> PLUGINS_SYM
...@@ -1598,6 +1594,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1598,6 +1594,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> SUSPEND_SYM %token <kwd> SUSPEND_SYM
%token <kwd> SWAPS_SYM %token <kwd> SWAPS_SYM
%token <kwd> SWITCHES_SYM %token <kwd> SWITCHES_SYM
%token <kwd> SYSTEM /* SQL-2011-R */
%token <kwd> SYSTEM_TIME_SYM /* SQL-2011-R */
%token <kwd> TABLES %token <kwd> TABLES
%token <kwd> TABLESPACE %token <kwd> TABLESPACE
%token <kwd> TABLE_CHECKSUM_SYM %token <kwd> TABLE_CHECKSUM_SYM
...@@ -1634,6 +1632,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1634,6 +1632,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> VALUE_SYM /* SQL-2003-R */ %token <kwd> VALUE_SYM /* SQL-2003-R */
%token <kwd> VARCHAR2 /* Oracle */ %token <kwd> VARCHAR2 /* Oracle */
%token <kwd> VARIABLES %token <kwd> VARIABLES
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> VIA_SYM %token <kwd> VIA_SYM
%token <kwd> VIEW_SYM /* SQL-2003-N */ %token <kwd> VIEW_SYM /* SQL-2003-N */
%token <kwd> VIRTUAL_SYM %token <kwd> VIRTUAL_SYM
...@@ -1642,6 +1641,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1642,6 +1641,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> WEEK_SYM %token <kwd> WEEK_SYM
%token <kwd> WEIGHT_STRING_SYM %token <kwd> WEIGHT_STRING_SYM
%token <kwd> WITHIN %token <kwd> WITHIN
%token <kwd> WITHOUT /* SQL-2003-R */
%token <kwd> WORK_SYM /* SQL-2003-N */ %token <kwd> WORK_SYM /* SQL-2003-N */
%token <kwd> WRAPPER_SYM %token <kwd> WRAPPER_SYM
%token <kwd> WRITE_SYM /* SQL-2003-N */ %token <kwd> WRITE_SYM /* SQL-2003-N */
......
...@@ -606,17 +606,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -606,17 +606,11 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token COMMENT_SYM %token COMMENT_SYM
%token ELSIF_SYM /* Oracle, reserved in PL/SQL*/ %token ELSIF_SYM /* Oracle, reserved in PL/SQL*/
%token GOTO_SYM /* Oracle, reserved in PL/SQL*/ %token GOTO_SYM /* Oracle, reserved in PL/SQL*/
%token HISTORY_SYM /* MYSQL */
%token OTHERS_SYM /* SQL-2011-N */ %token OTHERS_SYM /* SQL-2011-N */
%token PACKAGE_SYM /* Oracle-R */ %token PACKAGE_SYM /* Oracle-R */
%token PERIOD_SYM /* SQL-2011-R */
%token RAISE_SYM /* Oracle-PLSQL-R */ %token RAISE_SYM /* Oracle-PLSQL-R */
%token ROWTYPE_SYM /* Oracle-PLSQL-R */ %token ROWTYPE_SYM /* Oracle-PLSQL-R */
%token SYSTEM /* SQL-2011-R */
%token SYSTEM_TIME_SYM /* SQL-2011-R */
%token VERSIONING_SYM /* SQL-2011-R */
%token WINDOW_SYM %token WINDOW_SYM
%token WITHOUT /* SQL-2003-R */
/* /*
Non-reserved keywords Non-reserved keywords
...@@ -762,6 +756,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -762,6 +756,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> HASH_SYM %token <kwd> HASH_SYM
%token <kwd> HELP_SYM %token <kwd> HELP_SYM
%token <kwd> HIGH_PRIORITY %token <kwd> HIGH_PRIORITY
%token <kwd> HISTORY_SYM /* MYSQL */
%token <kwd> HOST_SYM %token <kwd> HOST_SYM
%token <kwd> HOSTS_SYM %token <kwd> HOSTS_SYM
%token <kwd> HOUR_SYM /* SQL-2003-R */ %token <kwd> HOUR_SYM /* SQL-2003-R */
...@@ -879,6 +874,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -879,6 +874,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> PARTITIONS_SYM %token <kwd> PARTITIONS_SYM
%token <kwd> PARTITIONING_SYM %token <kwd> PARTITIONING_SYM
%token <kwd> PASSWORD_SYM %token <kwd> PASSWORD_SYM
%token <kwd> PERIOD_SYM /* SQL-2011-R */
%token <kwd> PERSISTENT_SYM %token <kwd> PERSISTENT_SYM
%token <kwd> PHASE_SYM %token <kwd> PHASE_SYM
%token <kwd> PLUGINS_SYM %token <kwd> PLUGINS_SYM
...@@ -984,6 +980,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -984,6 +980,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> SUSPEND_SYM %token <kwd> SUSPEND_SYM
%token <kwd> SWAPS_SYM %token <kwd> SWAPS_SYM
%token <kwd> SWITCHES_SYM %token <kwd> SWITCHES_SYM
%token <kwd> SYSTEM /* SQL-2011-R */
%token <kwd> SYSTEM_TIME_SYM /* SQL-2011-R */
%token <kwd> TABLES %token <kwd> TABLES
%token <kwd> TABLESPACE %token <kwd> TABLESPACE
%token <kwd> TABLE_CHECKSUM_SYM %token <kwd> TABLE_CHECKSUM_SYM
...@@ -1020,6 +1018,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1020,6 +1018,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> VALUE_SYM /* SQL-2003-R */ %token <kwd> VALUE_SYM /* SQL-2003-R */
%token <kwd> VARCHAR2 /* Oracle */ %token <kwd> VARCHAR2 /* Oracle */
%token <kwd> VARIABLES %token <kwd> VARIABLES
%token <kwd> VERSIONING_SYM /* SQL-2011-R */
%token <kwd> VIA_SYM %token <kwd> VIA_SYM
%token <kwd> VIEW_SYM /* SQL-2003-N */ %token <kwd> VIEW_SYM /* SQL-2003-N */
%token <kwd> VIRTUAL_SYM %token <kwd> VIRTUAL_SYM
...@@ -1028,6 +1027,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); ...@@ -1028,6 +1027,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> WEEK_SYM %token <kwd> WEEK_SYM
%token <kwd> WEIGHT_STRING_SYM %token <kwd> WEIGHT_STRING_SYM
%token <kwd> WITHIN %token <kwd> WITHIN
%token <kwd> WITHOUT /* SQL-2003-R */
%token <kwd> WORK_SYM /* SQL-2003-N */ %token <kwd> WORK_SYM /* SQL-2003-N */
%token <kwd> WRAPPER_SYM %token <kwd> WRAPPER_SYM
%token <kwd> WRITE_SYM /* SQL-2003-N */ %token <kwd> WRITE_SYM /* SQL-2003-N */
...@@ -15102,8 +15102,6 @@ keyword: ...@@ -15102,8 +15102,6 @@ keyword:
xxx := 10; xxx := 10;
*/ */
keyword_directly_assignable: keyword_directly_assignable:
ASCII_SYM ASCII_SYM
| BACKUP_SYM | BACKUP_SYM
| BINLOG_SYM | BINLOG_SYM
...@@ -15125,12 +15123,14 @@ keyword_directly_assignable: ...@@ -15125,12 +15123,14 @@ keyword_directly_assignable:
| FORMAT_SYM | FORMAT_SYM
| GET_SYM | GET_SYM
| HELP_SYM | HELP_SYM
| HISTORY_SYM
| HOST_SYM | HOST_SYM
| INSTALL_SYM | INSTALL_SYM
| OPTION | OPTION
| OPTIONS_SYM | OPTIONS_SYM
| OWNER_SYM | OWNER_SYM
| PARSER_SYM | PARSER_SYM
| PERIOD_SYM
| PORT_SYM | PORT_SYM
| PRECEDING_SYM | PRECEDING_SYM
| PREPARE_SYM | PREPARE_SYM
...@@ -15147,11 +15147,15 @@ keyword_directly_assignable: ...@@ -15147,11 +15147,15 @@ keyword_directly_assignable:
| START_SYM | START_SYM
| STOP_SYM | STOP_SYM
| STORED_SYM | STORED_SYM
| SYSTEM
| SYSTEM_TIME_SYM
| TIES_SYM | TIES_SYM
| UNICODE_SYM | UNICODE_SYM
| UNINSTALL_SYM | UNINSTALL_SYM
| UNBOUNDED_SYM | UNBOUNDED_SYM
| VERSIONING_SYM
| WITHIN | WITHIN
| WITHOUT
| WRAPPER_SYM | WRAPPER_SYM
| XA_SYM | XA_SYM
| UPGRADE_SYM | UPGRADE_SYM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment