Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c2d8db66
Commit
c2d8db66
authored
Oct 03, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-20735 Allow non-reserved keywords as user defined type names
parent
d168601e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
237 additions
and
28 deletions
+237
-28
mysql-test/main/parser.result
mysql-test/main/parser.result
+31
-0
mysql-test/main/parser.test
mysql-test/main/parser.test
+40
-0
mysql-test/suite/compat/oracle/r/parser.result
mysql-test/suite/compat/oracle/r/parser.result
+35
-0
mysql-test/suite/compat/oracle/t/parser.test
mysql-test/suite/compat/oracle/t/parser.test
+45
-0
mysql-test/suite/funcs_1/r/storedproc.result
mysql-test/suite/funcs_1/r/storedproc.result
+6
-18
mysql-test/suite/funcs_1/t/storedproc.test
mysql-test/suite/funcs_1/t/storedproc.test
+6
-6
sql/sql_yacc.yy
sql/sql_yacc.yy
+37
-2
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+37
-2
No files found.
mysql-test/main/parser.result
View file @
c2d8db66
...
...
@@ -1809,5 +1809,36 @@ ERROR HY000: Unknown data type: 'DUAL'
SELECT CAST(1 AS DUAL);
ERROR HY000: Unknown data type: 'DUAL'
#
# MDEV-20735 Allow non-reserved keywords as user defined type names
#
CREATE TABLE t1 (a ASCII);
ERROR HY000: Unknown data type: 'ASCII'
SELECT CAST(1 AS ASCII);
ERROR HY000: Unknown data type: 'ASCII'
CREATE TABLE t1 (a LANGUAGE);
ERROR HY000: Unknown data type: 'LANGUAGE'
SELECT CAST(1 AS LANGUAGE);
ERROR HY000: Unknown data type: 'LANGUAGE'
CREATE TABLE t1 (a CLOSE);
ERROR HY000: Unknown data type: 'CLOSE'
SELECT CAST(1 AS CLOSE);
ERROR HY000: Unknown data type: 'CLOSE'
CREATE TABLE t1 (a NAMES);
ERROR HY000: Unknown data type: 'NAMES'
SELECT CAST(1 AS NAMES);
ERROR HY000: Unknown data type: 'NAMES'
CREATE TABLE t1 (a END);
ERROR HY000: Unknown data type: 'END'
SELECT CAST(1 AS END);
ERROR HY000: Unknown data type: 'END'
CREATE TABLE t1 (a GLOBAL);
ERROR HY000: Unknown data type: 'GLOBAL'
SELECT CAST(1 AS GLOBAL);
ERROR HY000: Unknown data type: 'GLOBAL'
CREATE TABLE t1 (a ACTION);
ERROR HY000: Unknown data type: 'ACTION'
SELECT CAST(1 AS ACTION);
ERROR HY000: Unknown data type: 'ACTION'
#
# End of 10.5 tests
#
mysql-test/main/parser.test
View file @
c2d8db66
...
...
@@ -1581,6 +1581,46 @@ CREATE TABLE t1 (a DUAL);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
DUAL
);
--
echo
#
--
echo
# MDEV-20735 Allow non-reserved keywords as user defined type names
--
echo
#
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
ASCII
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
ASCII
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
LANGUAGE
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
LANGUAGE
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
CLOSE
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
CLOSE
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
NAMES
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
NAMES
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
END
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
END
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
GLOBAL
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
GLOBAL
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
ACTION
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
ACTION
);
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
mysql-test/suite/compat/oracle/r/parser.result
View file @
c2d8db66
...
...
@@ -620,5 +620,40 @@ ERROR HY000: Unknown data type: 'DUAL'
SELECT CAST(1 AS DUAL);
ERROR HY000: Unknown data type: 'DUAL'
#
# MDEV-20735 Allow non-reserved keywords as user defined type names
#
CREATE TABLE t1 (a ASCII);
ERROR HY000: Unknown data type: 'ASCII'
SELECT CAST(1 AS ASCII);
ERROR HY000: Unknown data type: 'ASCII'
CREATE TABLE t1 (a LANGUAGE);
ERROR HY000: Unknown data type: 'LANGUAGE'
SELECT CAST(1 AS LANGUAGE);
ERROR HY000: Unknown data type: 'LANGUAGE'
CREATE TABLE t1 (a CLOSE);
ERROR HY000: Unknown data type: 'CLOSE'
SELECT CAST(1 AS CLOSE);
ERROR HY000: Unknown data type: 'CLOSE'
CREATE TABLE t1 (a NAMES);
ERROR HY000: Unknown data type: 'NAMES'
SELECT CAST(1 AS NAMES);
ERROR HY000: Unknown data type: 'NAMES'
CREATE TABLE t1 (a END);
ERROR HY000: Unknown data type: 'END'
SELECT CAST(1 AS END);
ERROR HY000: Unknown data type: 'END'
CREATE TABLE t1 (a GLOBAL);
ERROR HY000: Unknown data type: 'GLOBAL'
SELECT CAST(1 AS GLOBAL);
ERROR HY000: Unknown data type: 'GLOBAL'
CREATE TABLE t1 (a ACTION);
ERROR HY000: Unknown data type: 'ACTION'
SELECT CAST(1 AS ACTION);
ERROR HY000: Unknown data type: 'ACTION'
CREATE TABLE t1 (a BEGIN);
ERROR HY000: Unknown data type: 'BEGIN'
SELECT CAST(1 AS BEGIN);
ERROR HY000: Unknown data type: 'BEGIN'
#
# End of 10.5 tests
#
mysql-test/suite/compat/oracle/t/parser.test
View file @
c2d8db66
...
...
@@ -427,6 +427,51 @@ CREATE TABLE t1 (a DUAL);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
DUAL
);
--
echo
#
--
echo
# MDEV-20735 Allow non-reserved keywords as user defined type names
--
echo
#
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
ASCII
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
ASCII
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
LANGUAGE
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
LANGUAGE
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
CLOSE
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
CLOSE
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
NAMES
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
NAMES
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
END
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
END
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
GLOBAL
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
GLOBAL
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
ACTION
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
ACTION
);
--
error
ER_UNKNOWN_DATA_TYPE
CREATE
TABLE
t1
(
a
BEGIN
);
--
error
ER_UNKNOWN_DATA_TYPE
SELECT
CAST
(
1
AS
BEGIN
);
--
echo
#
--
echo
# End of 10.5 tests
--
echo
#
mysql-test/suite/funcs_1/r/storedproc.result
View file @
c2d8db66
No preview for this file type
mysql-test/suite/funcs_1/t/storedproc.test
View file @
c2d8db66
...
...
@@ -13752,7 +13752,7 @@ delimiter ;//
DROP
PROCEDURE
IF
EXISTS
handler1
;
delimiter
//;
--
error
ER_
PARSE_ERROR
--
error
ER_
UNKNOWN_DATA_TYPE
CREATE
PROCEDURE
handler1
()
BEGIN
declare
continueinv
handler
for
sqlstate
'2300'
set
@
x2
=
1
;
...
...
@@ -13776,7 +13776,7 @@ delimiter ;//
DROP
PROCEDURE
IF
EXISTS
handler1
;
delimiter
//;
--
error
ER_
PARSE_ERROR
--
error
ER_
UNKNOWN_DATA_TYPE
CREATE
PROCEDURE
handler1
()
BEGIN
declare
undoinv
handler
for
sqlstate
'2300'
set
@
x2
=
1
;
...
...
@@ -13800,7 +13800,7 @@ delimiter ;//
DROP
PROCEDURE
IF
EXISTS
handler1
;
delimiter
//;
--
error
ER_
PARSE_ERROR
--
error
ER_
UNKNOWN_DATA_TYPE
CREATE
PROCEDURE
handler1
()
BEGIN
declare
exitinv
handler
for
sqlstate
'2300'
set
@
x2
=
1
;
...
...
@@ -15210,7 +15210,7 @@ delimiter ;//
DROP
PROCEDURE
IF
EXISTS
sp1
;
delimiter
//;
--
error
ER_
PARSE_ERROR
--
error
ER_
UNKNOWN_DATA_TYPE
CREATE
PROCEDURE
sp1
(
)
BEGIN
declare
option
handler
for
sqlstate
'02000'
set
@
var2
=
1
;
...
...
@@ -15300,7 +15300,7 @@ delimiter ;//
DROP
PROCEDURE
IF
EXISTS
sp1
;
delimiter
//;
--
error
ER_
PARSE_ERROR
--
error
ER_
UNKNOWN_DATA_TYPE
CREATE
PROCEDURE
sp1
(
)
BEGIN
declare
privileges
handler
for
sqlstate
'02000'
set
@
var2
=
1
;
...
...
@@ -15360,7 +15360,7 @@ delimiter ;//
DROP
PROCEDURE
IF
EXISTS
sp1
;
delimiter
//;
--
error
ER_
PARSE_ERROR
--
error
ER_
UNKNOWN_DATA_TYPE
CREATE
PROCEDURE
sp1
(
)
BEGIN
declare
read_only
handler
for
sqlstate
'02000'
set
@
var2
=
1
;
...
...
sql/sql_yacc.yy
View file @
c2d8db66
...
...
@@ -1797,6 +1797,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <kwd>
keyword_data_type
keyword_cast_type
keyword_ident
keyword_label
keyword_set_special_case
...
...
@@ -1812,6 +1813,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_verb_clause
charset
reserved_keyword_udt
non_reserved_keyword_udt
%type <table>
table_ident table_ident_nodb references xid
...
...
@@ -6864,6 +6866,11 @@ field_type:
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
;
field_type_numeric:
...
...
@@ -11915,6 +11922,11 @@ cast_type:
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt
{
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
}
;
cast_type_numeric:
...
...
@@ -15798,6 +15810,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15805,11 +15818,13 @@ keyword_table_alias:
| keyword_sp_var_not_label
| keyword_sysvar_type
| keyword_verb_clause
| EXCEPTION_ORACLE_SYM
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15818,6 +15833,7 @@ keyword_ident:
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
| EXCEPTION_ORACLE_SYM
;
/*
...
...
@@ -15829,10 +15845,12 @@ keyword_label:
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sysvar_type
| EXCEPTION_ORACLE_SYM
;
keyword_sysvar_name:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15840,10 +15858,12 @@ keyword_sysvar_name:
| keyword_sp_var_not_label
| keyword_verb_clause
| WINDOW_SYM
| EXCEPTION_ORACLE_SYM
;
keyword_sp_decl:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15856,6 +15876,7 @@ keyword_sp_decl:
keyword_set_usual_case:
keyword_data_type
| keyword_cast_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
...
...
@@ -15863,6 +15884,17 @@ keyword_set_usual_case:
| keyword_sysvar_type
| keyword_verb_clause
| WINDOW_SYM
| EXCEPTION_ORACLE_SYM
;
non_reserved_keyword_udt:
keyword_sp_var_not_label
| keyword_sp_head
| keyword_verb_clause
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sysvar_type
| keyword_sp_var_and_label
;
/*
...
...
@@ -15914,7 +15946,6 @@ keyword_sp_var_not_label:
| RESTORE_SYM
| SECURITY_SYM
| SERVER_SYM
| SIGNED_SYM
| SOCKET_SYM
| SLAVE
| SLAVES
...
...
@@ -16009,7 +16040,6 @@ keyword_set_special_case:
*/
keyword_sp_block_section:
BEGIN_MARIADB_SYM
| EXCEPTION_ORACLE_SYM
| END
;
...
...
@@ -16054,6 +16084,11 @@ keyword_data_type:
;
keyword_cast_type:
SIGNED_SYM
;
/*
These keywords are fine for both SP variable names and SP labels.
*/
...
...
sql/sql_yacc_ora.yy
View file @
c2d8db66
...
...
@@ -1266,6 +1266,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <kwd>
keyword_data_type
keyword_cast_type
keyword_ident
keyword_label
keyword_set_special_case
...
...
@@ -1282,6 +1283,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
keyword_directly_assignable
charset
reserved_keyword_udt
non_reserved_keyword_udt
%type <table>
table_ident table_ident_nodb references xid
...
...
@@ -6863,6 +6865,11 @@ field_type:
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt float_options srid_option
{
if (Lex->set_field_type_udt(&$$, $1, $2))
MYSQL_YYABORT;
}
;
...
...
@@ -12014,6 +12021,11 @@ cast_type:
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
}
| non_reserved_keyword_udt
{
if (Lex->set_cast_type_udt(&$$, $1))
MYSQL_YYABORT;
}
;
cast_type_numeric:
...
...
@@ -15950,6 +15962,7 @@ user: user_maybe_role
/* Keywords which we allow as table aliases. */
keyword_table_alias:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15958,11 +15971,13 @@ keyword_table_alias:
| keyword_sysvar_type
| keyword_verb_clause
| FUNCTION_SYM
| EXCEPTION_ORACLE_SYM
;
/* Keyword that we allow for identifiers (except SP labels) */
keyword_ident:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15972,6 +15987,7 @@ keyword_ident:
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
| EXCEPTION_ORACLE_SYM
;
/*
...
...
@@ -15985,10 +16001,12 @@ keyword_label:
| keyword_sysvar_type
| FUNCTION_SYM
| COMPRESSED_SYM
| EXCEPTION_ORACLE_SYM
;
keyword_sysvar_name:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sp_head
...
...
@@ -15997,6 +16015,7 @@ keyword_sysvar_name:
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
| EXCEPTION_ORACLE_SYM
;
keyword_sp_decl:
...
...
@@ -16011,6 +16030,7 @@ keyword_sp_decl:
keyword_set_usual_case:
keyword_data_type
| keyword_cast_type
| keyword_sp_block_section
| keyword_sp_head
| keyword_sp_var_and_label
...
...
@@ -16019,10 +16039,12 @@ keyword_set_usual_case:
| keyword_verb_clause
| FUNCTION_SYM
| WINDOW_SYM
| EXCEPTION_ORACLE_SYM
;
keyword_directly_assignable:
keyword_data_type
| keyword_cast_type
| keyword_set_special_case
| keyword_sp_var_and_label
| keyword_sp_var_not_label
...
...
@@ -16031,6 +16053,16 @@ keyword_directly_assignable:
| WINDOW_SYM
;
non_reserved_keyword_udt:
keyword_sp_var_not_label
| keyword_sp_head
| keyword_verb_clause
| keyword_set_special_case
| keyword_sp_block_section
| keyword_sysvar_type
| keyword_sp_var_and_label
;
/*
Keywords that we allow in Oracle-style direct assignments:
xxx := 10;
...
...
@@ -16080,7 +16112,6 @@ keyword_sp_var_not_label:
| RESTORE_SYM
| SECURITY_SYM
| SERVER_SYM
| SIGNED_SYM
| SOCKET_SYM
| SLAVE
| SLAVES
...
...
@@ -16175,7 +16206,6 @@ keyword_set_special_case:
*/
keyword_sp_block_section:
BEGIN_ORACLE_SYM
| EXCEPTION_ORACLE_SYM
| END
;
...
...
@@ -16220,6 +16250,11 @@ keyword_data_type:
;
keyword_cast_type:
SIGNED_SYM
;
/*
These keywords are fine for both SP variable names and SP labels.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment