MDEV-35229 NOCOPY has become reserved word bringing wide incompatibility
This patch was suggested by Sergei Golubchik. It reverts the second patch from the PR: commit fa5eeb49316884dd21f9e28784f76cd027306ff8 Fixed ALTER TABLE NOCOPY keyword failure and adds NOCOPY_SYM into keyword_func_sp_var_and_label. The price is one extra shift/recuce conflict in yy_oracle.yy. This should to tolerable.
This commit is contained in:
parent
8c0a260a5b
commit
556a40dce0
16
mysql-test/include/keyword_non_reserved.inc
Normal file
16
mysql-test/include/keyword_non_reserved.inc
Normal file
@ -0,0 +1,16 @@
|
||||
eval CREATE TABLE $keyword (a INT);
|
||||
eval DROP TABLE $keyword;
|
||||
|
||||
eval CREATE TABLE t1 ($keyword int);
|
||||
eval SELECT $keyword AS $keyword FROM t1 AS $keyword;
|
||||
eval DROP TABLE t1;
|
||||
|
||||
|
||||
eval CREATE TABLE $keyword ($keyword INT);
|
||||
eval CREATE TRIGGER $keyword AFTER INSERT ON $keyword FOR EACH ROW BEGIN END;
|
||||
eval DROP TRIGGER $keyword;
|
||||
eval DROP TABLE $keyword;
|
||||
|
||||
eval PREPARE $keyword FROM 'select 1';
|
||||
eval EXECUTE $keyword;
|
||||
eval DEALLOCATE PREPARE $keyword;
|
@ -2264,3 +2264,54 @@ $$
|
||||
#
|
||||
# End of 10.6 tests
|
||||
#
|
||||
#
|
||||
# Start of 11.7 tests
|
||||
#
|
||||
#
|
||||
# MDEV-35229 NOCOPY has become reserved word bringing wide incompatibility
|
||||
#
|
||||
CREATE TABLE nocopy (a INT);
|
||||
DROP TABLE nocopy;
|
||||
CREATE TABLE t1 (nocopy int);
|
||||
SELECT nocopy AS nocopy FROM t1 AS nocopy;
|
||||
nocopy
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE nocopy (nocopy INT);
|
||||
CREATE TRIGGER nocopy AFTER INSERT ON nocopy FOR EACH ROW BEGIN END;
|
||||
DROP TRIGGER nocopy;
|
||||
DROP TABLE nocopy;
|
||||
PREPARE nocopy FROM 'select 1';
|
||||
EXECUTE nocopy;
|
||||
1
|
||||
1
|
||||
DEALLOCATE PREPARE nocopy;
|
||||
CREATE FUNCTION nocopy (nocopy INT) RETURNS INT RETURN nocopy;
|
||||
Warnings:
|
||||
Note 1585 This function 'nocopy' has the same name as a native function
|
||||
SELECT nocopy(1);
|
||||
nocopy(1)
|
||||
1
|
||||
Warnings:
|
||||
Note 1585 This function 'nocopy' has the same name as a native function
|
||||
DROP FUNCTION nocopy;
|
||||
CREATE PROCEDURE nocopy (nocopy INT) SELECT nocopy;
|
||||
CALL nocopy(1);
|
||||
nocopy
|
||||
1
|
||||
DROP PROCEDURE nocopy;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE nocopy INT DEFAULT 1;
|
||||
nocopy:
|
||||
WHILE 1 DO
|
||||
BEGIN
|
||||
SELECT nocopy;
|
||||
LEAVE nocopy;
|
||||
END;
|
||||
END WHILE;
|
||||
END;
|
||||
$$
|
||||
nocopy
|
||||
1
|
||||
#
|
||||
# End of 11.7 tests
|
||||
#
|
||||
|
@ -2067,3 +2067,49 @@ DELIMITER ;$$
|
||||
--echo #
|
||||
--echo # End of 10.6 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 11.7 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35229 NOCOPY has become reserved word bringing wide incompatibility
|
||||
--echo #
|
||||
|
||||
--let $keyword=nocopy
|
||||
--source include/keyword_non_reserved.inc
|
||||
|
||||
# Statements like "CREATE FUNCTION nocopy" and "SELECT nocopy()" below
|
||||
# erroneously prints a warning:
|
||||
# This function 'nocopy' has the same name as a native function
|
||||
# Though it's not really a function, it's just a keyword.
|
||||
# This warning is not printed with ps protocol. Let's disable ps protocol.
|
||||
|
||||
--disable_ps_protocol
|
||||
CREATE FUNCTION nocopy (nocopy INT) RETURNS INT RETURN nocopy;
|
||||
SELECT nocopy(1);
|
||||
DROP FUNCTION nocopy;
|
||||
--enable_ps_protocol
|
||||
|
||||
CREATE PROCEDURE nocopy (nocopy INT) SELECT nocopy;
|
||||
CALL nocopy(1);
|
||||
DROP PROCEDURE nocopy;
|
||||
|
||||
DELIMITER $$;
|
||||
BEGIN NOT ATOMIC
|
||||
DECLARE nocopy INT DEFAULT 1;
|
||||
nocopy:
|
||||
WHILE 1 DO
|
||||
BEGIN
|
||||
SELECT nocopy;
|
||||
LEAVE nocopy;
|
||||
END;
|
||||
END WHILE;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
--echo #
|
||||
--echo # End of 11.7 tests
|
||||
--echo #
|
||||
|
@ -469,10 +469,7 @@ BEGIN
|
||||
RETURN 0;
|
||||
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 'NOCOPY p_in INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN 0;
|
||||
END' at line 1
|
||||
ERROR HY000: Unknown data type: 'p_in'
|
||||
#
|
||||
# sql_mode=DEFAULT to perform the negative test case. Test with function, OUT NOCOPY
|
||||
#
|
||||
@ -481,10 +478,7 @@ BEGIN
|
||||
RETURN 0;
|
||||
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 'NOCOPY p_out INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN 0;
|
||||
END' at line 1
|
||||
ERROR HY000: Unknown data type: 'p_out'
|
||||
#
|
||||
# sql_mode=DEFAULT to perform the negative test case. Test with function, INOUT NOCOPY
|
||||
#
|
||||
@ -493,10 +487,7 @@ BEGIN
|
||||
RETURN 0;
|
||||
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 'NOCOPY p_inout INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN 0;
|
||||
END' at line 1
|
||||
ERROR HY000: Unknown data type: 'p_inout'
|
||||
#
|
||||
# sql_mode=DEFAULT to perform the negative test case. Test with procedure, IN NOCOPY
|
||||
#
|
||||
@ -504,9 +495,7 @@ CREATE OR REPLACE PROCEDURE example_proc(IN NOCOPY p_in INT)
|
||||
BEGIN
|
||||
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 'NOCOPY p_in INT)
|
||||
BEGIN
|
||||
END' at line 1
|
||||
ERROR HY000: Unknown data type: 'p_in'
|
||||
#
|
||||
# sql_mode=DEFAULT to perform the negative test case. Test with procedure, OUT NOCOPY
|
||||
#
|
||||
@ -514,9 +503,7 @@ CREATE OR REPLACE PROCEDURE example_proc(OUT NOCOPY p_out INT)
|
||||
BEGIN
|
||||
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 'NOCOPY p_out INT)
|
||||
BEGIN
|
||||
END' at line 1
|
||||
ERROR HY000: Unknown data type: 'p_out'
|
||||
#
|
||||
# sql_mode=DEFAULT to perform the negative test case. Test with procedure, INOUT NOCOPY
|
||||
#
|
||||
@ -524,6 +511,83 @@ CREATE OR REPLACE PROCEDURE example_proc(INOUT NOCOPY p_inout INT)
|
||||
BEGIN
|
||||
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 'NOCOPY p_inout INT)
|
||||
ERROR HY000: Unknown data type: 'p_inout'
|
||||
#
|
||||
# MDEV-35229 NOCOPY has become reserved word bringing wide incompatibility
|
||||
#
|
||||
SET sql_mode=ORACLE;
|
||||
CREATE TABLE nocopy (a INT);
|
||||
DROP TABLE nocopy;
|
||||
CREATE TABLE t1 (nocopy int);
|
||||
SELECT nocopy AS nocopy FROM t1 AS nocopy;
|
||||
nocopy
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE nocopy (nocopy INT);
|
||||
CREATE TRIGGER nocopy AFTER INSERT ON nocopy FOR EACH ROW BEGIN END;
|
||||
DROP TRIGGER nocopy;
|
||||
DROP TABLE nocopy;
|
||||
PREPARE nocopy FROM 'select 1';
|
||||
EXECUTE nocopy;
|
||||
1
|
||||
1
|
||||
DEALLOCATE PREPARE nocopy;
|
||||
CREATE FUNCTION nocopy (nocopy INT) RETURN INT AS
|
||||
BEGIN
|
||||
END' at line 1
|
||||
RETURN nocopy;
|
||||
END;
|
||||
$$
|
||||
Warnings:
|
||||
Note 1585 This function 'nocopy' has the same name as a native function
|
||||
SELECT nocopy(1);
|
||||
nocopy(1)
|
||||
1
|
||||
Warnings:
|
||||
Note 1585 This function 'nocopy' has the same name as a native function
|
||||
DROP FUNCTION nocopy;
|
||||
CREATE FUNCTION nocopy (nocopy nocopy INT) RETURN INT AS
|
||||
BEGIN
|
||||
RETURN nocopy;
|
||||
END;
|
||||
$$
|
||||
Warnings:
|
||||
Note 1585 This function 'nocopy' has the same name as a native function
|
||||
SELECT nocopy(1);
|
||||
nocopy(1)
|
||||
1
|
||||
Warnings:
|
||||
Note 1585 This function 'nocopy' has the same name as a native function
|
||||
DROP FUNCTION nocopy;
|
||||
CREATE PROCEDURE nocopy (nocopy INT) AS
|
||||
BEGIN
|
||||
SELECT nocopy;
|
||||
END;
|
||||
$$
|
||||
CALL nocopy(1);
|
||||
nocopy
|
||||
1
|
||||
DROP PROCEDURE nocopy;
|
||||
CREATE PROCEDURE nocopy (nocopy nocopy INT) AS
|
||||
BEGIN
|
||||
SELECT nocopy;
|
||||
END;
|
||||
$$
|
||||
CALL nocopy(1);
|
||||
nocopy
|
||||
1
|
||||
DROP PROCEDURE nocopy;
|
||||
DECLARE
|
||||
nocopy INT := 1;
|
||||
BEGIN
|
||||
<<nocopy>>
|
||||
WHILE 1
|
||||
LOOP
|
||||
SELECT nocopy;
|
||||
LEAVE nocopy;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
nocopy
|
||||
1
|
||||
#
|
||||
# End of 11.7 tests
|
||||
#
|
||||
|
@ -426,7 +426,7 @@ DELIMITER $$;
|
||||
--echo # sql_mode=DEFAULT to perform the negative test case. Test with function, IN NOCOPY
|
||||
--echo #
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
--error ER_UNKNOWN_DATA_TYPE
|
||||
CREATE OR REPLACE FUNCTION example_func(IN NOCOPY p_in INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN 0;
|
||||
@ -437,7 +437,7 @@ $$
|
||||
--echo # sql_mode=DEFAULT to perform the negative test case. Test with function, OUT NOCOPY
|
||||
--echo #
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
--error ER_UNKNOWN_DATA_TYPE
|
||||
CREATE OR REPLACE FUNCTION example_func(OUT NOCOPY p_out INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN 0;
|
||||
@ -448,7 +448,7 @@ $$
|
||||
--echo # sql_mode=DEFAULT to perform the negative test case. Test with function, INOUT NOCOPY
|
||||
--echo #
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
--error ER_UNKNOWN_DATA_TYPE
|
||||
CREATE OR REPLACE FUNCTION example_func(INOUT NOCOPY p_inout INT) RETURNS INT
|
||||
BEGIN
|
||||
RETURN 0;
|
||||
@ -459,7 +459,7 @@ $$
|
||||
--echo # sql_mode=DEFAULT to perform the negative test case. Test with procedure, IN NOCOPY
|
||||
--echo #
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
--error ER_UNKNOWN_DATA_TYPE
|
||||
CREATE OR REPLACE PROCEDURE example_proc(IN NOCOPY p_in INT)
|
||||
BEGIN
|
||||
END;
|
||||
@ -469,7 +469,7 @@ $$
|
||||
--echo # sql_mode=DEFAULT to perform the negative test case. Test with procedure, OUT NOCOPY
|
||||
--echo #
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
--error ER_UNKNOWN_DATA_TYPE
|
||||
CREATE OR REPLACE PROCEDURE example_proc(OUT NOCOPY p_out INT)
|
||||
BEGIN
|
||||
END;
|
||||
@ -479,10 +479,93 @@ $$
|
||||
--echo # sql_mode=DEFAULT to perform the negative test case. Test with procedure, INOUT NOCOPY
|
||||
--echo #
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
--error ER_UNKNOWN_DATA_TYPE
|
||||
CREATE OR REPLACE PROCEDURE example_proc(INOUT NOCOPY p_inout INT)
|
||||
BEGIN
|
||||
END;
|
||||
$$
|
||||
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35229 NOCOPY has become reserved word bringing wide incompatibility
|
||||
--echo #
|
||||
|
||||
SET sql_mode=ORACLE;
|
||||
--let keyword=nocopy
|
||||
--source include/keyword_non_reserved.inc
|
||||
|
||||
# Statements like "CREATE FUNCTION nocopy" and "SELECT nocopy()" below
|
||||
# erroneously print a warning:
|
||||
# This function 'nocopy' has the same name as a native function
|
||||
# Though it's not really a function, it's just a keyword.
|
||||
# The warning is not printed with ps protocol. Let's disable ps protocol.
|
||||
|
||||
--disable_ps_protocol
|
||||
|
||||
# nocopy is a parameter name
|
||||
DELIMITER $$;
|
||||
CREATE FUNCTION nocopy (nocopy INT) RETURN INT AS
|
||||
BEGIN
|
||||
RETURN nocopy;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SELECT nocopy(1);
|
||||
DROP FUNCTION nocopy;
|
||||
|
||||
# The first nocopy is a parameter name, the second nocopy - is the mode
|
||||
DELIMITER $$;
|
||||
CREATE FUNCTION nocopy (nocopy nocopy INT) RETURN INT AS
|
||||
BEGIN
|
||||
RETURN nocopy;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
SELECT nocopy(1);
|
||||
DROP FUNCTION nocopy;
|
||||
|
||||
--enable_ps_protocol
|
||||
|
||||
|
||||
# nocopy is a parameter name
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE nocopy (nocopy INT) AS
|
||||
BEGIN
|
||||
SELECT nocopy;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL nocopy(1);
|
||||
DROP PROCEDURE nocopy;
|
||||
|
||||
# The first nocopy is a parameter name, the second nocopy - is the mode
|
||||
DELIMITER $$;
|
||||
CREATE PROCEDURE nocopy (nocopy nocopy INT) AS
|
||||
BEGIN
|
||||
SELECT nocopy;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
CALL nocopy(1);
|
||||
DROP PROCEDURE nocopy;
|
||||
|
||||
DELIMITER $$;
|
||||
DECLARE
|
||||
nocopy INT := 1;
|
||||
BEGIN
|
||||
<<nocopy>>
|
||||
WHILE 1
|
||||
LOOP
|
||||
SELECT nocopy;
|
||||
LEAVE nocopy;
|
||||
END LOOP;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 11.7 tests
|
||||
--echo #
|
||||
|
@ -357,7 +357,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
%ifdef MARIADB
|
||||
%expect 62
|
||||
%else
|
||||
%expect 62
|
||||
%expect 63
|
||||
%endif
|
||||
|
||||
/*
|
||||
@ -1473,8 +1473,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
opt_recursive opt_format_xid opt_for_portion_of_time_clause
|
||||
ignorability
|
||||
|
||||
%type <alter_table_algo_val> alter_algorithm_option_is_kwd
|
||||
|
||||
%type <object_ddl_options>
|
||||
create_or_replace
|
||||
opt_if_not_exists
|
||||
@ -8039,15 +8037,10 @@ opt_index_lock_algorithm:
|
||||
| alter_algorithm_option alter_lock_option
|
||||
;
|
||||
|
||||
alter_algorithm_option_is_kwd:
|
||||
DEFAULT { $$ = Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; }
|
||||
| NOCOPY_SYM { $$ = Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY; }
|
||||
;
|
||||
|
||||
alter_algorithm_option:
|
||||
ALGORITHM_SYM opt_equal alter_algorithm_option_is_kwd
|
||||
ALGORITHM_SYM opt_equal DEFAULT
|
||||
{
|
||||
Lex->alter_info.set_requested_algorithm($3);
|
||||
Lex->alter_info.set_requested_algorithm(Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT);
|
||||
}
|
||||
| ALGORITHM_SYM opt_equal ident
|
||||
{
|
||||
@ -16388,6 +16381,7 @@ keyword_func_sp_var_and_label:
|
||||
| NOMINVALUE_SYM
|
||||
| NOMAXVALUE_SYM
|
||||
| NO_WAIT_SYM
|
||||
| NOCOPY_SYM
|
||||
| NOWAIT_SYM
|
||||
| NODEGROUP_SYM
|
||||
| NONE_SYM
|
||||
|
Loading…
x
Reference in New Issue
Block a user