1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-27816 Set sql_mode before DROP IF EXISTS already

Previously the correct SQL mode for a stored routine or
package was only set before doing the CREATE part, this
worked out for PROCEDUREs and FUNCTIONs, but with ORACLE
mode specific PACKAGEs the DROP also only works in ORACLE
mode.

Moving the setting of the sql_mode a few lines up to happen
right before the DROP statement is writen fixes this.
This commit is contained in:
Hartmut Holzgraefe
2022-04-29 10:10:02 +02:00
committed by Daniel Black
parent 06562b84f6
commit 9fe3bc2aa8
8 changed files with 102 additions and 49 deletions

View File

@ -2885,4 +2885,35 @@ INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4);
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
--echo #
--echo # MDEV-27186 Server fails to load a dump, taken on the same version
--echo # Oracle mode with packages
--echo #
CREATE DATABASE test1;
CREATE DATABASE test2;
USE test1;
SET @save_sql_mode=@@sql_mode;
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE OR REPLACE PACKAGE pkg AS
END;
$$
DELIMITER ;$$
--echo # Dump database 1
--exec $MYSQL_DUMP --routines test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql
--echo # Restore from database 1 to database 2
--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql
use test2;
SHOW CREATE PACKAGE pkg;
DROP DATABASE test1;
DROP DATABASE test2;
SET sql_mode=@save_sql_mode;
--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
--echo # End of 10.3 tests