summaryrefslogtreecommitdiff
path: root/mysql-test/main
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2018-05-17 16:01:20 +0400
committerAlexander Barkov <bar@mariadb.com>2018-05-17 16:01:20 +0400
commit10d44db5d49a138ed25b227912ac938100d666fa (patch)
treeecc52f8ce26eaae7f2440fd97a9f138d10253a48 /mysql-test/main
parent21b12e33594f9f943d1c3678005f034858af2b03 (diff)
downloadmariadb-git-10d44db5d49a138ed25b227912ac938100d666fa.tar.gz
MDEV-16202 Latest changes made erroneously some keywords reserved in sql_mode=ORACLE
Diffstat (limited to 'mysql-test/main')
-rw-r--r--mysql-test/main/parser.result331
-rw-r--r--mysql-test/main/parser.test64
2 files changed, 395 insertions, 0 deletions
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index a1c6e86a129..2394c958b47 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1349,3 +1349,334 @@ SET GLOBAL a=10;
END;
$$
ERROR HY000: Unknown system variable 'a'
+#
+# MDEV-16202 Latest changes made erroneously some keywords reserved in sql_mode=ORACLE
+#
+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;
+$$
+CALL p2('date');
+BEGIN NOT ATOMIC DECLARE date INT; SET date=10; SELECT date; END
+10
+SELECT date FROM t1
+SELECT date 'alias' FROM t1
+Error 1525 Incorrect DATE value: 'alias'
+SELECT date()
+Error 1064 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 ')' at line 1
+SELECT date.date()
+Error 1630 FUNCTION date.date does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT date DATE FROM t1
+SELECT date HISTORY FROM t1
+SELECT date NEXT FROM t1
+SELECT date PERIOD FROM t1
+SELECT date PREVIOUS FROM t1
+SELECT date SYSTEM FROM t1
+SELECT date SYSTEM_TIME FROM t1
+SELECT date TIME FROM t1
+SELECT date TIMESTAMP FROM t1
+SELECT date TRANSACTION FROM t1
+SELECT date VALUE FROM t1
+SELECT date VERSIONING FROM t1
+SELECT date WITHOUT FROM t1
+CALL p2('history');
+BEGIN NOT ATOMIC DECLARE history INT; SET history=10; SELECT history; END
+10
+SELECT history FROM t1
+SELECT history 'alias' FROM t1
+SELECT history()
+Error 1064 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 '()' at line 1
+SELECT history.history()
+Error 1630 FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT history DATE FROM t1
+SELECT history HISTORY FROM t1
+SELECT history NEXT FROM t1
+SELECT history PERIOD FROM t1
+SELECT history PREVIOUS FROM t1
+SELECT history SYSTEM FROM t1
+SELECT history SYSTEM_TIME FROM t1
+SELECT history TIME FROM t1
+SELECT history TIMESTAMP FROM t1
+SELECT history TRANSACTION FROM t1
+SELECT history VALUE FROM t1
+SELECT history VERSIONING FROM t1
+SELECT history WITHOUT FROM t1
+CALL p2('next');
+BEGIN NOT ATOMIC DECLARE next INT; SET next=10; SELECT next; END
+10
+SELECT next FROM t1
+SELECT next 'alias' FROM t1
+SELECT next()
+Error 1064 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 '()' at line 1
+SELECT next.next()
+Error 1630 FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT next DATE FROM t1
+SELECT next HISTORY FROM t1
+SELECT next NEXT FROM t1
+SELECT next PERIOD FROM t1
+SELECT next PREVIOUS FROM t1
+SELECT next SYSTEM FROM t1
+SELECT next SYSTEM_TIME FROM t1
+SELECT next TIME FROM t1
+SELECT next TIMESTAMP FROM t1
+SELECT next TRANSACTION FROM t1
+SELECT next VALUE FROM t1
+Error 1064 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 'FROM t1' at line 1
+SELECT next VERSIONING FROM t1
+SELECT next WITHOUT FROM t1
+CALL p2('period');
+BEGIN NOT ATOMIC DECLARE period INT; SET period=10; SELECT period; END
+10
+SELECT period FROM t1
+SELECT period 'alias' FROM t1
+SELECT period()
+Error 1064 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 '()' at line 1
+SELECT period.period()
+Error 1630 FUNCTION period.period does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT period DATE FROM t1
+SELECT period HISTORY FROM t1
+SELECT period NEXT FROM t1
+SELECT period PERIOD FROM t1
+SELECT period PREVIOUS FROM t1
+SELECT period SYSTEM FROM t1
+SELECT period SYSTEM_TIME FROM t1
+SELECT period TIME FROM t1
+SELECT period TIMESTAMP FROM t1
+SELECT period TRANSACTION FROM t1
+SELECT period VALUE FROM t1
+SELECT period VERSIONING FROM t1
+SELECT period WITHOUT FROM t1
+CALL p2('previous');
+BEGIN NOT ATOMIC DECLARE previous INT; SET previous=10; SELECT previous; END
+10
+SELECT previous FROM t1
+SELECT previous 'alias' FROM t1
+SELECT previous()
+Error 1064 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 '()' at line 1
+SELECT previous.previous()
+Error 1630 FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT previous DATE FROM t1
+SELECT previous HISTORY FROM t1
+SELECT previous NEXT FROM t1
+SELECT previous PERIOD FROM t1
+SELECT previous PREVIOUS FROM t1
+SELECT previous SYSTEM FROM t1
+SELECT previous SYSTEM_TIME FROM t1
+SELECT previous TIME FROM t1
+SELECT previous TIMESTAMP FROM t1
+SELECT previous TRANSACTION FROM t1
+SELECT previous VALUE FROM t1
+Error 1064 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 'FROM t1' at line 1
+SELECT previous VERSIONING FROM t1
+SELECT previous WITHOUT FROM t1
+CALL p2('system');
+BEGIN NOT ATOMIC DECLARE system INT; SET system=10; SELECT system; END
+10
+SELECT system FROM t1
+SELECT system 'alias' FROM t1
+SELECT system()
+Error 1064 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 '()' at line 1
+SELECT system.system()
+Error 1630 FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT system DATE FROM t1
+SELECT system HISTORY FROM t1
+SELECT system NEXT FROM t1
+SELECT system PERIOD FROM t1
+SELECT system PREVIOUS FROM t1
+SELECT system SYSTEM FROM t1
+SELECT system SYSTEM_TIME FROM t1
+SELECT system TIME FROM t1
+SELECT system TIMESTAMP FROM t1
+SELECT system TRANSACTION FROM t1
+SELECT system VALUE FROM t1
+SELECT system VERSIONING FROM t1
+SELECT system WITHOUT FROM t1
+CALL p2('system_time');
+BEGIN NOT ATOMIC DECLARE system_time INT; SET system_time=10; SELECT system_time; END
+10
+SELECT system_time FROM t1
+SELECT system_time 'alias' FROM t1
+SELECT system_time()
+Error 1064 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 '()' at line 1
+SELECT system_time.system_time()
+Error 1630 FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT system_time DATE FROM t1
+SELECT system_time HISTORY FROM t1
+SELECT system_time NEXT FROM t1
+SELECT system_time PERIOD FROM t1
+SELECT system_time PREVIOUS FROM t1
+SELECT system_time SYSTEM FROM t1
+SELECT system_time SYSTEM_TIME FROM t1
+SELECT system_time TIME FROM t1
+SELECT system_time TIMESTAMP FROM t1
+SELECT system_time TRANSACTION FROM t1
+SELECT system_time VALUE FROM t1
+SELECT system_time VERSIONING FROM t1
+SELECT system_time WITHOUT FROM t1
+CALL p2('time');
+BEGIN NOT ATOMIC DECLARE time INT; SET time=10; SELECT time; END
+10
+SELECT time FROM t1
+SELECT time 'alias' FROM t1
+Error 1525 Incorrect TIME value: 'alias'
+SELECT time()
+Error 1064 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 ')' at line 1
+SELECT time.time()
+Error 1630 FUNCTION time.time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT time DATE FROM t1
+SELECT time HISTORY FROM t1
+SELECT time NEXT FROM t1
+SELECT time PERIOD FROM t1
+SELECT time PREVIOUS FROM t1
+SELECT time SYSTEM FROM t1
+SELECT time SYSTEM_TIME FROM t1
+SELECT time TIME FROM t1
+SELECT time TIMESTAMP FROM t1
+SELECT time TRANSACTION FROM t1
+SELECT time VALUE FROM t1
+SELECT time VERSIONING FROM t1
+SELECT time WITHOUT FROM t1
+CALL p2('timestamp');
+BEGIN NOT ATOMIC DECLARE timestamp INT; SET timestamp=10; SELECT timestamp; END
+10
+SELECT timestamp FROM t1
+SELECT timestamp 'alias' FROM t1
+Error 1525 Incorrect DATETIME value: 'alias'
+SELECT timestamp()
+Error 1064 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 ')' at line 1
+SELECT timestamp.timestamp()
+Error 1630 FUNCTION timestamp.timestamp does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT timestamp DATE FROM t1
+SELECT timestamp HISTORY FROM t1
+SELECT timestamp NEXT FROM t1
+SELECT timestamp PERIOD FROM t1
+SELECT timestamp PREVIOUS FROM t1
+SELECT timestamp SYSTEM FROM t1
+SELECT timestamp SYSTEM_TIME FROM t1
+SELECT timestamp TIME FROM t1
+SELECT timestamp TIMESTAMP FROM t1
+SELECT timestamp TRANSACTION FROM t1
+SELECT timestamp VALUE FROM t1
+SELECT timestamp VERSIONING FROM t1
+SELECT timestamp WITHOUT FROM t1
+CALL p2('transaction');
+BEGIN NOT ATOMIC DECLARE transaction INT; SET transaction=10; SELECT transaction; END
+10
+SELECT transaction FROM t1
+SELECT transaction 'alias' FROM t1
+SELECT transaction()
+Error 1064 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 '()' at line 1
+SELECT transaction.transaction()
+Error 1630 FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT transaction DATE FROM t1
+SELECT transaction HISTORY FROM t1
+SELECT transaction NEXT FROM t1
+SELECT transaction PERIOD FROM t1
+SELECT transaction PREVIOUS FROM t1
+SELECT transaction SYSTEM FROM t1
+SELECT transaction SYSTEM_TIME FROM t1
+SELECT transaction TIME FROM t1
+SELECT transaction TIMESTAMP FROM t1
+SELECT transaction TRANSACTION FROM t1
+SELECT transaction VALUE FROM t1
+SELECT transaction VERSIONING FROM t1
+SELECT transaction WITHOUT FROM t1
+CALL p2('value');
+BEGIN NOT ATOMIC DECLARE value INT; SET value=10; SELECT value; END
+10
+SELECT value FROM t1
+SELECT value 'alias' FROM t1
+SELECT value()
+Error 1064 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 ')' at line 1
+SELECT value.value()
+Error 1630 FUNCTION value.value does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT value DATE FROM t1
+SELECT value HISTORY FROM t1
+SELECT value NEXT FROM t1
+SELECT value PERIOD FROM t1
+SELECT value PREVIOUS FROM t1
+SELECT value SYSTEM FROM t1
+SELECT value SYSTEM_TIME FROM t1
+SELECT value TIME FROM t1
+SELECT value TIMESTAMP FROM t1
+SELECT value TRANSACTION FROM t1
+SELECT value VALUE FROM t1
+SELECT value VERSIONING FROM t1
+SELECT value WITHOUT FROM t1
+CALL p2('versioning');
+BEGIN NOT ATOMIC DECLARE versioning INT; SET versioning=10; SELECT versioning; END
+10
+SELECT versioning FROM t1
+SELECT versioning 'alias' FROM t1
+SELECT versioning()
+Error 1064 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 '()' at line 1
+SELECT versioning.versioning()
+Error 1630 FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT versioning DATE FROM t1
+SELECT versioning HISTORY FROM t1
+SELECT versioning NEXT FROM t1
+SELECT versioning PERIOD FROM t1
+SELECT versioning PREVIOUS FROM t1
+SELECT versioning SYSTEM FROM t1
+SELECT versioning SYSTEM_TIME FROM t1
+SELECT versioning TIME FROM t1
+SELECT versioning TIMESTAMP FROM t1
+SELECT versioning TRANSACTION FROM t1
+SELECT versioning VALUE FROM t1
+SELECT versioning VERSIONING FROM t1
+SELECT versioning WITHOUT FROM t1
+CALL p2('without');
+BEGIN NOT ATOMIC DECLARE without INT; SET without=10; SELECT without; END
+10
+SELECT without FROM t1
+SELECT without 'alias' FROM t1
+SELECT without()
+Error 1064 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 '()' at line 1
+SELECT without.without()
+Error 1630 FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
+SELECT without DATE FROM t1
+SELECT without HISTORY FROM t1
+SELECT without NEXT FROM t1
+SELECT without PERIOD FROM t1
+SELECT without PREVIOUS FROM t1
+SELECT without SYSTEM FROM t1
+SELECT without SYSTEM_TIME FROM t1
+SELECT without TIME FROM t1
+SELECT without TIMESTAMP FROM t1
+SELECT without TRANSACTION FROM t1
+SELECT without VALUE FROM t1
+SELECT without VERSIONING FROM t1
+SELECT without WITHOUT FROM t1
+DROP PROCEDURE p2;
+DROP PROCEDURE p1;
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index 1f176c6afc5..8faab613a0c 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1379,3 +1379,67 @@ BEGIN NOT ATOMIC
END;
$$
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;