Commit ca906fb2 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13686 EXCEPTION reserved keyword in SQL_MODE=oracle but not in Oracle itself

parent 2bd6ccae
...@@ -273,6 +273,8 @@ CREATE PROCEDURE p1 (rollback OUT INT) AS BEGIN rollback:=10; END;/ ...@@ -273,6 +273,8 @@ CREATE PROCEDURE p1 (rollback OUT INT) AS BEGIN rollback:=10; END;/
ERROR 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 ':=10; END' at line 1 ERROR 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 ':=10; END' at line 1
CREATE PROCEDURE p1 (shutdown OUT INT) AS BEGIN shutdown:=10; END;/ CREATE PROCEDURE p1 (shutdown OUT INT) AS BEGIN shutdown:=10; END;/
ERROR 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 ':=10; END' at line 1 ERROR 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 ':=10; END' at line 1
CREATE PROCEDURE p1 (exception OUT INT) AS BEGIN exception:=10; END;/
ERROR 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 ':=10; END' at line 1
# Testing that keyword_directly_not_assignable works in SET statements. # Testing that keyword_directly_not_assignable works in SET statements.
CREATE PROCEDURE p1 (contains OUT INT) AS BEGIN SET contains=10; END;/ CREATE PROCEDURE p1 (contains OUT INT) AS BEGIN SET contains=10; END;/
DROP PROCEDURE p1/ DROP PROCEDURE p1/
...@@ -300,6 +302,8 @@ CREATE PROCEDURE p1 (begin OUT INT) AS BEGIN SET begin=10; END;/ ...@@ -300,6 +302,8 @@ CREATE PROCEDURE p1 (begin OUT INT) AS BEGIN SET begin=10; END;/
DROP PROCEDURE p1/ DROP PROCEDURE p1/
CREATE PROCEDURE p1 (end OUT INT) AS BEGIN SET end=10; END;/ CREATE PROCEDURE p1 (end OUT INT) AS BEGIN SET end=10; END;/
DROP PROCEDURE p1/ DROP PROCEDURE p1/
CREATE PROCEDURE p1 (exception OUT INT) AS BEGIN SET exception=10; END;/
DROP PROCEDURE p1/
# Testing that keyword_directly_not_assignable works in table/column names # Testing that keyword_directly_not_assignable works in table/column names
CREATE TABLE contains (contains INT); CREATE TABLE contains (contains INT);
DROP TABLE contains; DROP TABLE contains;
...@@ -327,6 +331,8 @@ CREATE TABLE begin (begin INT); ...@@ -327,6 +331,8 @@ CREATE TABLE begin (begin INT);
DROP TABLE begin; DROP TABLE begin;
CREATE TABLE end (end INT); CREATE TABLE end (end INT);
DROP TABLE end; DROP TABLE end;
CREATE TABLE exception (exception INT);
DROP TABLE exception;
# Testing ELSIF # Testing ELSIF
CREATE FUNCTION f1(a INT) RETURN CLOB CREATE FUNCTION f1(a INT) RETURN CLOB
AS AS
...@@ -2282,3 +2288,12 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is ...@@ -2282,3 +2288,12 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def SQL%ROWCOUNT 8 21 1 N 32897 0 63 def SQL%ROWCOUNT 8 21 1 N 32897 0 63
SQL%ROWCOUNT SQL%ROWCOUNT
0 0
#
# MDEV-13686 EXCEPTION reserved keyword in SQL_MODE=oracle but not in Oracle itself
#
CREATE TABLE t1 (c1 int);
CREATE VIEW v1 AS SELECT c1 exception FROM t1;
SELECT exception FROM v1;
exception
DROP VIEW v1;
DROP TABLE t1;
...@@ -286,6 +286,8 @@ CREATE PROCEDURE p1 (commit OUT INT) AS BEGIN commit:=10; END;/ ...@@ -286,6 +286,8 @@ CREATE PROCEDURE p1 (commit OUT INT) AS BEGIN commit:=10; END;/
CREATE PROCEDURE p1 (rollback OUT INT) AS BEGIN rollback:=10; END;/ CREATE PROCEDURE p1 (rollback OUT INT) AS BEGIN rollback:=10; END;/
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE p1 (shutdown OUT INT) AS BEGIN shutdown:=10; END;/ CREATE PROCEDURE p1 (shutdown OUT INT) AS BEGIN shutdown:=10; END;/
--error ER_PARSE_ERROR
CREATE PROCEDURE p1 (exception OUT INT) AS BEGIN exception:=10; END;/
DELIMITER ;/ DELIMITER ;/
...@@ -317,6 +319,8 @@ CREATE PROCEDURE p1 (begin OUT INT) AS BEGIN SET begin=10; END;/ ...@@ -317,6 +319,8 @@ CREATE PROCEDURE p1 (begin OUT INT) AS BEGIN SET begin=10; END;/
DROP PROCEDURE p1/ DROP PROCEDURE p1/
CREATE PROCEDURE p1 (end OUT INT) AS BEGIN SET end=10; END;/ CREATE PROCEDURE p1 (end OUT INT) AS BEGIN SET end=10; END;/
DROP PROCEDURE p1/ DROP PROCEDURE p1/
CREATE PROCEDURE p1 (exception OUT INT) AS BEGIN SET exception=10; END;/
DROP PROCEDURE p1/
DELIMITER ;/ DELIMITER ;/
--echo # Testing that keyword_directly_not_assignable works in table/column names --echo # Testing that keyword_directly_not_assignable works in table/column names
...@@ -346,6 +350,8 @@ CREATE TABLE begin (begin INT); ...@@ -346,6 +350,8 @@ CREATE TABLE begin (begin INT);
DROP TABLE begin; DROP TABLE begin;
CREATE TABLE end (end INT); CREATE TABLE end (end INT);
DROP TABLE end; DROP TABLE end;
CREATE TABLE exception (exception INT);
DROP TABLE exception;
--echo # Testing ELSIF --echo # Testing ELSIF
DELIMITER /; DELIMITER /;
...@@ -2131,3 +2137,12 @@ DROP PROCEDURE p1; ...@@ -2131,3 +2137,12 @@ DROP PROCEDURE p1;
SELECT SQL%ROWCOUNT; SELECT SQL%ROWCOUNT;
--enable_ps_protocol --enable_ps_protocol
--disable_metadata --disable_metadata
--echo #
--echo # MDEV-13686 EXCEPTION reserved keyword in SQL_MODE=oracle but not in Oracle itself
--echo #
CREATE TABLE t1 (c1 int);
CREATE VIEW v1 AS SELECT c1 exception FROM t1;
SELECT exception FROM v1;
DROP VIEW v1;
DROP TABLE t1;
...@@ -1073,7 +1073,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -1073,7 +1073,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token EXCEPT_SYM /* SQL-2003-R */ %token EXCEPT_SYM /* SQL-2003-R */
%token EXCLUDE_SYM /* SQL-2011-N */ %token EXCLUDE_SYM /* SQL-2011-N */
%token EXECUTE_SYM /* SQL-2003-R */ %token EXECUTE_SYM /* SQL-2003-R */
%token EXCEPTION_SYM /* SQL-2003-N */ %token EXCEPTION_SYM /* SQL-2003-N, Oracle-PLSQL-R */
%token EXISTS /* SQL-2003-R */ %token EXISTS /* SQL-2003-R */
%token EXIT_SYM %token EXIT_SYM
%token EXPANSION_SYM %token EXPANSION_SYM
......
...@@ -482,7 +482,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); ...@@ -482,7 +482,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token EXCEPT_SYM /* SQL-2003-R */ %token EXCEPT_SYM /* SQL-2003-R */
%token EXCLUDE_SYM /* SQL-2011-N */ %token EXCLUDE_SYM /* SQL-2011-N */
%token EXECUTE_SYM /* SQL-2003-R */ %token EXECUTE_SYM /* SQL-2003-R */
%token EXCEPTION_SYM /* SQL-2003-N */ %token EXCEPTION_SYM /* SQL-2003-N, Oracle-PLSQL-R */
%token EXISTS /* SQL-2003-R */ %token EXISTS /* SQL-2003-R */
%token EXIT_SYM %token EXIT_SYM
%token EXPANSION_SYM %token EXPANSION_SYM
...@@ -14796,7 +14796,7 @@ keyword_sp: ...@@ -14796,7 +14796,7 @@ keyword_sp:
/* /*
Keywords that start a statement. Keywords that start a statement or an SP block section.
Generally allowed as identifiers (e.g. table, column names) Generally allowed as identifiers (e.g. table, column names)
- not allowed as SP label names - not allowed as SP label names
- not allowed as variable names in Oracle-style assignments: - not allowed as variable names in Oracle-style assignments:
...@@ -14806,6 +14806,7 @@ keyword_sp_verb_clause: ...@@ -14806,6 +14806,7 @@ keyword_sp_verb_clause:
BEGIN_SYM { /* Compound. Reserved in Oracle */ } BEGIN_SYM { /* Compound. Reserved in Oracle */ }
| CLOSE_SYM { /* Verb clause. Reserved in Oracle */ } | CLOSE_SYM { /* Verb clause. Reserved in Oracle */ }
| COMMIT_SYM { /* Verb clause. Reserved in Oracle */ } | COMMIT_SYM { /* Verb clause. Reserved in Oracle */ }
| EXCEPTION_SYM { /* EXCEPTION section in SP blocks */ }
| DO_SYM { /* Verb clause */ } | DO_SYM { /* Verb clause */ }
| END { /* Compound. Reserved in Oracle */ } | END { /* Compound. Reserved in Oracle */ }
| HANDLER_SYM { /* Verb clause */ } | HANDLER_SYM { /* Verb clause */ }
......
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