1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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 fa5eeb4931
    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:
Alexander Barkov
2024-10-29 09:52:42 +04:00
parent 8c0a260a5b
commit 556a40dce0
6 changed files with 290 additions and 36 deletions

View File

@@ -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
#