mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
6217dd728a
The cause of the crash is an assertion failure that we do not emit an error message (grant not found) and then return "ok". The assertion is valid, and we were ignoring the buggy behavior prior to the "Diagnostics" result-verification. Use an error handler to mutate innocuous missing-grant errors, when removing routines, into warnings.
199 lines
5 KiB
Text
199 lines
5 KiB
Text
# Initialise
|
|
--disable_warnings
|
|
drop table if exists t1;
|
|
drop database if exists mysqltest;
|
|
# If earlier test failed
|
|
drop database if exists client_test_db;
|
|
--enable_warnings
|
|
|
|
--error 1051
|
|
drop table t1;
|
|
create table t1(n int);
|
|
insert into t1 values(1);
|
|
create temporary table t1( n int);
|
|
insert into t1 values(2);
|
|
--error 1050
|
|
create table t1(n int);
|
|
drop table t1;
|
|
select * from t1;
|
|
|
|
# now test for a bug in drop database - it is important that the name
|
|
# of the table is the same as the name of the database - in the original
|
|
# code this triggered a bug
|
|
create database mysqltest;
|
|
drop database if exists mysqltest;
|
|
create database mysqltest;
|
|
create table mysqltest.mysqltest (n int);
|
|
insert into mysqltest.mysqltest values (4);
|
|
select * from mysqltest.mysqltest;
|
|
--enable_info
|
|
drop database if exists mysqltest;
|
|
--disable_info
|
|
create database mysqltest;
|
|
|
|
#
|
|
# drop many tables - bug#3891
|
|
# we'll do it in mysqltest db, to be able to use longer table names
|
|
# (tableN instead on tN)
|
|
#
|
|
use mysqltest;
|
|
--error 1051
|
|
drop table table1, table2, table3, table4, table5, table6,
|
|
table7, table8, table9, table10, table11, table12, table13,
|
|
table14, table15, table16, table17, table18, table19, table20,
|
|
table21, table22, table23, table24, table25, table26, table27,
|
|
table28;
|
|
|
|
--error 1051
|
|
drop table table1, table2, table3, table4, table5, table6,
|
|
table7, table8, table9, table10, table11, table12, table13,
|
|
table14, table15, table16, table17, table18, table19, table20,
|
|
table21, table22, table23, table24, table25, table26, table27,
|
|
table28, table29, table30;
|
|
|
|
use test;
|
|
drop database mysqltest;
|
|
|
|
# test drop/create database and FLUSH TABLES WITH READ LOCK
|
|
flush tables with read lock;
|
|
--error 1209,1223
|
|
create database mysqltest;
|
|
unlock tables;
|
|
create database mysqltest;
|
|
show databases;
|
|
flush tables with read lock;
|
|
--error 1208,1223
|
|
drop database mysqltest;
|
|
unlock tables;
|
|
drop database mysqltest;
|
|
show databases;
|
|
--error 1008
|
|
drop database mysqltest;
|
|
|
|
# test create table and FLUSH TABLES WITH READ LOCK
|
|
drop table t1;
|
|
flush tables with read lock;
|
|
--error 1223
|
|
create table t1(n int);
|
|
unlock tables;
|
|
create table t1(n int);
|
|
show tables;
|
|
drop table t1;
|
|
|
|
# End of 4.1 tests
|
|
|
|
|
|
#
|
|
# Test for bug#21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes
|
|
# server to crash". Crash (caused by failed assertion in 5.0 or by null
|
|
# pointer dereference in 5.1) happened when one ran SHOW OPEN TABLES
|
|
# while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE
|
|
# or any other command that takes name-lock) in other connection.
|
|
#
|
|
# Also includes test for similar bug#12212 "Crash that happens during
|
|
# removing of database name from cache" reappeared in 5.1 as bug#19403
|
|
# In its case crash happened when one concurrently executed DROP DATABASE
|
|
# and one of name-locking command.
|
|
#
|
|
--disable_warnings
|
|
drop database if exists mysqltest;
|
|
drop table if exists t1;
|
|
--enable_warnings
|
|
create table t1 (i int);
|
|
lock tables t1 read;
|
|
create database mysqltest;
|
|
connect (addconroot1, localhost, root,,);
|
|
--send drop table t1
|
|
connect (addconroot2, localhost, root,,);
|
|
# Server should not crash in any of the following statements
|
|
--disable_result_log
|
|
show open tables;
|
|
--enable_result_log
|
|
--send drop database mysqltest
|
|
connection default;
|
|
select 1;
|
|
unlock tables;
|
|
connection addconroot1;
|
|
--reap
|
|
connection addconroot2;
|
|
--reap
|
|
disconnect addconroot1;
|
|
disconnect addconroot2;
|
|
connection default;
|
|
|
|
--echo End of 5.0 tests
|
|
|
|
#
|
|
# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file
|
|
#
|
|
create database mysql_test;
|
|
create table mysql_test.t1(f1 int);
|
|
create table mysql_test.`#sql-347f_7` (f1 int);
|
|
create table mysql_test.`#sql-347f_8` (f1 int);
|
|
drop table mysql_test.`#sql-347f_8`;
|
|
copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm;
|
|
drop database mysql_test;
|
|
|
|
|
|
#
|
|
# Bug#33464: DROP FUNCTION caused a crash.
|
|
#
|
|
CREATE DATABASE dbbug33464;
|
|
CREATE USER 'userbug33464'@'localhost';
|
|
|
|
GRANT CREATE ROUTINE ON dbbug33464.* TO 'userbug33464'@'localhost';
|
|
|
|
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
connect (connbug33464, localhost, userbug33464, , dbbug33464);
|
|
--source suite/funcs_1/include/show_connection.inc
|
|
|
|
--disable_warnings
|
|
DROP PROCEDURE IF EXISTS sp3;
|
|
DROP FUNCTION IF EXISTS fn1;
|
|
--enable_warnings
|
|
|
|
delimiter //;
|
|
CREATE PROCEDURE sp3(v1 char(20))
|
|
BEGIN
|
|
SELECT * from dbbug33464.t6 where t6.f2= 'xyz';
|
|
END//
|
|
delimiter ;//
|
|
|
|
delimiter //;
|
|
CREATE FUNCTION fn1() returns char(50) SQL SECURITY INVOKER
|
|
BEGIN
|
|
return 1;
|
|
END//
|
|
delimiter ;//
|
|
|
|
delimiter //;
|
|
CREATE FUNCTION fn2() returns char(50) SQL SECURITY DEFINER
|
|
BEGIN
|
|
return 2;
|
|
END//
|
|
delimiter ;//
|
|
|
|
disconnect connbug33464;
|
|
|
|
# cleanup
|
|
connection default;
|
|
USE dbbug33464;
|
|
--source suite/funcs_1/include/show_connection.inc
|
|
|
|
SELECT fn1();
|
|
SELECT fn2();
|
|
|
|
--error 0, ER_CANNOT_USER
|
|
DROP USER 'userbug33464'@'localhost';
|
|
|
|
DROP FUNCTION fn1;
|
|
DROP FUNCTION fn2;
|
|
DROP PROCEDURE sp3;
|
|
|
|
--error 0, ER_CANNOT_USER
|
|
DROP USER 'userbug33464'@'localhost';
|
|
|
|
use test;
|
|
DROP DATABASE dbbug33464;
|
|
|
|
--echo End of 5.1 tests
|