1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge 5.0.80 release and 5.0 community. Version left at 5.0.80.

This commit is contained in:
Chad MILLER
2009-04-14 13:20:13 -04:00
397 changed files with 11101 additions and 8316 deletions

View File

@ -1,4 +1,4 @@
# In order to be more or less robust test for bug#25044 has to take
# In order to be more or less robust test for Bug#25044 has to take
# significant time (e.g. about 9 seconds on my (Dmitri's) computer)
# so we probably want execute it only in --big-test mode.
# Also in 5.1 this test will require statement-based binlog.
@ -6,8 +6,8 @@
#
# Test for bug #25044 "ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock".
# Test for Bug#25044 ALTER TABLE ... ENABLE KEYS acquires global
# 'opening tables' lock
#
# ALTER TABLE ... ENABLE KEYS should not acquire LOCK_open mutex for
# the whole its duration as it prevents other queries from execution.
@ -57,6 +57,7 @@ show binlog events in 'master-bin.000001' from 98;
# Clean up
drop tables t1, t2;
disconnect addconroot;
--echo End of 5.0 tests

View File

@ -1,7 +1,10 @@
# The server need to be started in $MYSQLTEST_VARDIR since it
# uses ../std_data_ln/
-- source include/uses_vardir.inc
--source include/uses_vardir.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# This test is a bit tricky as we can't use backup table to overwrite an old
@ -12,7 +15,7 @@ connect (con2,localhost,root,,);
connection con1;
set SQL_LOG_BIN=0;
--disable_warnings
drop table if exists t1, t2, t3;
drop table if exists t1, t2, t3, t4;
--enable_warnings
create table t4(n int);
--replace_result ": 1" ": X" ": 2" ": X" ": 22" ": X" ": 23" ": X" $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@ -57,6 +60,9 @@ unlock tables;
connection con1;
reap;
drop table t5;
connection default;
disconnect con1;
disconnect con2;
remove_file $MYSQLTEST_VARDIR/tmp/t1.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t2.MYD;
remove_file $MYSQLTEST_VARDIR/tmp/t3.MYD;
@ -68,4 +74,9 @@ remove_file $MYSQLTEST_VARDIR/tmp/t3.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t4.frm;
remove_file $MYSQLTEST_VARDIR/tmp/t5.frm;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -161,4 +161,44 @@ DROP TABLE t1;
DROP DATABASE bug39182;
USE test;
#
# Bug#35383: binlog playback and replication breaks due to
# name_const substitution
#
DELIMITER //;
CREATE PROCEDURE p1(IN v1 INT)
BEGIN
CREATE TABLE t1 SELECT v1;
DROP TABLE t1;
END//
CREATE PROCEDURE p2()
BEGIN
DECLARE v1 INT;
CREATE TABLE t1 SELECT v1+1;
DROP TABLE t1;
END//
CREATE PROCEDURE p3(IN v1 INT)
BEGIN
CREATE TABLE t1 SELECT 1 FROM DUAL WHERE v1!=0;
DROP TABLE t1;
END//
CREATE PROCEDURE p4(IN v1 INT)
BEGIN
DECLARE v2 INT;
CREATE TABLE t1 SELECT 1, v1, v2;
DROP TABLE t1;
CREATE TABLE t1 SELECT 1, v1+1, v2;
DROP TABLE t1;
END//
DELIMITER ;//
CALL p1(1);
CALL p2();
CALL p3(0);
CALL p4(0);
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
DROP PROCEDURE p4;
--echo End of 5.0 tests

View File

@ -1,8 +1,12 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
drop table if exists t1,t2;
drop view if exists v1;
--enable_warnings
# Add a lot of keys to slow down check
@ -20,16 +24,18 @@ connection con2;
insert into t1 values (200000);
connection con1;
reap;
connection default;
disconnect con1;
disconnect con2;
drop table t1;
# End of 4.1 tests
#
# Bug #9897 Views: 'Check Table' crashes MySQL, with a view and a table
# in the statement
# Bug#9897 Views: 'Check Table' crashes MySQL, with a view and a table
# in the statement
#
connection default;
Create table t1(f1 int);
Create table t2(f1 int);
Create view v1 as Select * from t1;
@ -37,11 +43,15 @@ Check Table v1,t2;
drop view v1;
drop table t1, t2;
#
# BUG#26325 - TEMPORARY TABLE "corrupt" after first read, according to CHECK
# TABLE
# Bug#26325 TEMPORARY TABLE "corrupt" after first read, according to CHECK TABLE
#
CREATE TEMPORARY TABLE t1(a INT);
CHECK TABLE t1;
REPAIR TABLE t1;
DROP TABLE t1;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -6,6 +6,10 @@
-- source include/have_compress.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (comp_con,localhost,root,,,,,COMPRESS);
# Check compression turned on
@ -16,3 +20,10 @@ SHOW STATUS LIKE 'Compression';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
connection default;
disconnect comp_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -18,12 +18,16 @@ connect (con2,localhost,root,,test);
show tables;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,root,z,);
connection default;
disconnect con1;
disconnect con2;
grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling";
@ -35,20 +39,23 @@ show tables;
connect (con4,localhost,test,gambling,test);
show tables;
connection default;
disconnect con3;
disconnect con4;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,"");
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges;
@ -57,30 +64,34 @@ connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql);
connection con5;
set password="";
--error 1372
--error ER_PASSWD_LENGTH
set password='gambling3';
set password=old_password('gambling3');
show tables;
connect (con6,localhost,test,gambling3,test);
show tables;
connection default;
disconnect con10;
disconnect con5;
disconnect con6;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,test2);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test'
# do not depend on this test.
delete from mysql.user where user=_binary"test";
flush privileges;
@ -98,4 +109,5 @@ disconnect con7;
connection default;
drop table t1;
# End of 4.1 tests

View File

@ -1,43 +1,61 @@
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
### Test 1:
### - While a consistent snapshot transaction is executed,
### no external inserts should be visible to the transaction.
--echo # Switch to connection con1
connection con1;
create table t1 (a int) engine=innodb;
start transaction with consistent snapshot;
CREATE TABLE t1 (a INT) ENGINE=innodb;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--echo # Switch to connection con2
connection con2;
insert into t1 values(1);
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1;
select * from t1; # if consistent snapshot was set as expected, we
SELECT * FROM t1; # if consistent snapshot was set as expected, we
# should see nothing.
commit;
COMMIT;
### Test 2:
### - For any non-consistent snapshot transaction, external
### committed inserts should be visible to the transaction.
delete from t1;
start transaction; # Now we omit WITH CONSISTENT SNAPSHOT
DELETE FROM t1;
START TRANSACTION; # Now we omit WITH CONSISTENT SNAPSHOT
--echo # Switch to connection con2
connection con2;
insert into t1 values(1);
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con1
connection con1;
select * from t1; # if consistent snapshot was not set, as expected, we
SELECT * FROM t1; # if consistent snapshot was not set, as expected, we
# should see 1.
commit;
COMMIT;
drop table t1;
--echo # Switch to connection default + close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
DROP TABLE t1;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -229,3 +229,17 @@ insert into t1 set a=0x6c;
insert into t1 set a=0x4c98;
check table t1 extended;
drop table t1;
#
# Bug#41627 Illegal mix of collations in LEAST / GREATEST / CASE
#
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);
create table t1
select least(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci) as f1;
show create table t1;
drop table t1;
select case _latin1'a' when _latin2'b' then 1 when _latin5'c' collate
latin5_turkish_ci then 2 else 3 end;
select concat(_latin1'a',_latin2'b',_latin5'c' collate latin5_turkish_ci);

View File

@ -337,3 +337,15 @@ select str_to_date('04/30 /2004', '%m /%d /%Y');
select str_to_date('04/30/2004 ', '%m/%d/%Y ');
--echo "End of 4.1 tests"
#
# Bug #41470: DATE_FORMAT() crashes the complete server with a valid date
#
# show that these two do not crash the server:
SELECT DATE_FORMAT("0000-01-01",'%W %d %M %Y') as valid_date;
SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date;
# show that date within the Gregorian range render correct results: (THU)
SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date;
--echo "End of 5.0 tests"

View File

@ -1,3 +1,7 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
@ -5,12 +9,19 @@ dirty_close con1;
connection con2;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (n int);
insert into t1 values (1),(2),(3);
select * from t1;
drop table t1;
CREATE TABLE t1 (n INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT * FROM t1;
DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -123,4 +123,17 @@ execute s1;
DROP TABLE t1,t2;
#
# Bug #43354: Use key hint can crash server in explain extended query
#
CREATE TABLE t1 (a INT PRIMARY KEY);
--error ER_KEY_DOES_NOT_EXITS
EXPLAIN EXTENDED SELECT COUNT(a) FROM t1 USE KEY(a);
DROP TABLE t1;
# End of 5.0 tests.

View File

@ -1843,6 +1843,28 @@ DROP TABLE t1;
connection master;
DROP TABLE t1;
--echo #
--echo # BUG#21360 - mysqldump error on federated tables
--echo #
connection slave;
--echo #Switch to Connection Slave
CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id));
INSERT INTO t1 VALUES ('text1'),('text2'),('text3'),('text4');
connection master;
--echo #Switch to Connection Master
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval CREATE TABLE t1(id VARCHAR(20) NOT NULL, PRIMARY KEY(id)) ENGINE=FEDERATED
CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1';
--echo # Dump table t1 using mysqldump tool
--replace_result $SLAVE_MYPORT SLAVE_PORT
--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;
connection slave;
--echo #Switch to Connection Slave
DROP TABLE t1;
connection default;
--echo End of 5.0 tests

View File

@ -4,74 +4,106 @@
# This is intended to mimick how mysqldump and innobackup work.
# And it requires InnoDB
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
--echo # Establish connection con3 (user=root)
connect (con3,localhost,root,,);
--echo # Switch to connection con1
connection con1;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (a int) engine=innodb;
CREATE TABLE t1 (a INT) ENGINE=innodb;
# blocks COMMIT ?
begin;
insert into t1 values(1);
BEGIN;
INSERT INTO t1 VALUES(1);
--echo # Switch to connection con2
connection con2;
flush tables with read lock;
select * from t1;
FLUSH TABLES WITH READ LOCK;
SELECT * FROM t1;
--echo # Switch to connection con1
connection con1;
send commit; # blocked by con2
send COMMIT; # blocked by con2
sleep 1;
--echo # Switch to connection con2
connection con2;
select * from t1; # verify con1 was blocked and data did not move
unlock tables;
SELECT * FROM t1; # verify con1 was blocked and data did not move
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
reap;
# No deadlock ?
--echo # Switch to connection con1
connection con1;
begin;
select * from t1 for update;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
--echo # Switch to connection con2
connection con2;
begin;
send select * from t1 for update; # blocked by con1
BEGIN;
send SELECT * FROM t1 FOR UPDATE; # blocked by con1
sleep 1;
--echo # Switch to connection con3
connection con3;
send flush tables with read lock; # blocked by con2
send FLUSH TABLES WITH READ LOCK; # blocked by con2
--echo # Switch to connection con1
connection con1;
commit; # should not be blocked by con3
COMMIT; # should not be blocked by con3
--echo # Switch to connection con2
connection con2;
reap;
--echo # Switch to connection con3
connection con3;
reap;
unlock tables;
UNLOCK TABLES;
# BUG#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK
# Bug#6732 FLUSH TABLES WITH READ LOCK + COMMIT hangs later FLUSH TABLES
# WITH READ LOCK
--echo # Switch to connection con2
connection con2;
commit; # unlock InnoDB row locks to allow insertions
COMMIT; # unlock InnoDB row locks to allow insertions
--echo # Switch to connection con1
connection con1;
begin;
insert into t1 values(10);
flush tables with read lock;
commit;
unlock tables;
BEGIN;
INSERT INTO t1 VALUES(10);
FLUSH TABLES WITH READ LOCK;
COMMIT;
UNLOCK TABLES;
--echo # Switch to connection con2
connection con2;
flush tables with read lock; # bug caused hang here
unlock tables;
FLUSH TABLES WITH READ LOCK; # bug caused hang here
UNLOCK TABLES;
# BUG#7358 SHOW CREATE DATABASE fails if open transaction
# Bug#7358 SHOW CREATE DATABASE fails if open transaction
begin;
select * from t1;
show create database test;
BEGIN;
SELECT * FROM t1;
SHOW CREATE DATABASE test;
drop table t1;
DROP TABLE t1;
# Cleanup
--echo # Switch to connection default and close connections con1, con2, con3
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
# End of 4.1 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,32 +3,51 @@
# We verify that we did not introduce a deadlock.
# This is intended to mimick how mysqldump and innobackup work.
-- source include/have_log_bin.inc
--source include/have_log_bin.inc
# And it requires InnoDB
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo # Establish connection con1 (user=root)
connect (con1,localhost,root,,);
--echo # Establish connection con2 (user=root)
connect (con2,localhost,root,,);
# FLUSH TABLES WITH READ LOCK should block writes to binlog too
--echo # Switch to connection con1
connection con1;
create table t1 (a int) engine=innodb;
reset master;
set autocommit=0;
insert t1 values (1);
CREATE TABLE t1 (a INT) ENGINE=innodb;
RESET MASTER;
SET AUTOCOMMIT=0;
INSERT t1 VALUES (1);
--echo # Switch to connection con2
connection con2;
flush tables with read lock;
show master status;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
--echo # Switch to connection con1
connection con1;
send commit;
send COMMIT;
--echo # Switch to connection con2
connection con2;
sleep 1;
show master status;
unlock tables;
SHOW MASTER STATUS;
UNLOCK TABLES;
--echo # Switch to connection con1
connection con1;
reap;
drop table t1;
set autocommit=1;
DROP TABLE t1;
SET AUTOCOMMIT=1;
--echo # Switch to connection default and close connections con1 and con2
connection default;
disconnect con1;
disconnect con2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -8,19 +8,27 @@
# won't test anything interesting).
# This also won't work with the embedded server test
-- source include/not_embedded.inc
--source include/not_embedded.inc
-- source include/have_debug.inc
--source include/have_debug.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Disable concurrent inserts to avoid test failures when reading the
# connection id which was inserted into a table by another thread.
SET @old_concurrent_insert= @@global.concurrent_insert;
SET @@global.concurrent_insert= 0;
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (kill_id int);
insert into t1 values(connection_id());
CREATE TABLE t1 (kill_id INT);
INSERT INTO t1 VALUES(connection_id());
# Thanks to the parameter we passed to --debug, this FLUSH will
# block on a debug build running with our --debug=make_global... It
@ -28,14 +36,14 @@ insert into t1 values(connection_id());
# --debug) it will succeed immediately
connection con1;
send flush tables with read lock;
send FLUSH TABLES WITH READ LOCK;
# kill con1
connection con2;
select ((@id := kill_id) - kill_id) from t1;
SELECT ((@id := kill_id) - kill_id) FROM t1;
--sleep 2 # leave time for FLUSH to block
kill connection @id;
KILL CONNECTION @id;
connection con1;
# On debug builds it will be error 1053 (killed); on non-debug, or
@ -46,4 +54,13 @@ connection con1;
reap;
connection con2;
drop table t1;
DROP TABLE t1;
connection default;
disconnect con2;
# Restore global concurrent_insert value
SET @@global.concurrent_insert= @old_concurrent_insert;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -432,3 +432,11 @@ INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
DROP TABLE t1;
#
# BUG#36737 - having + full text operator crashes mysql
#
CREATE TABLE t1(a TEXT);
--error ER_WRONG_ARGUMENTS
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
DROP TABLE t1;

View File

@ -229,5 +229,25 @@ INSERT INTO t1 VALUES ('a');
SELECT a DIV 2 FROM t1 UNION SELECT a DIV 2 FROM t1;
DROP TABLE t1;
#
# Bug #15936: "round" differs on Windows to Unix
#
CREATE TABLE t1 (a DOUBLE);
INSERT INTO t1 VALUES (-1.1), (1.1),
(-1.5), (1.5),
(-1.9), (1.9),
(-2.1), (2.1),
(-2.5), (2.5),
(-2.9), (2.9),
# Check numbers with absolute values > 2^53 - 1
# (see comments for MAX_EXACT_INTEGER)
(-1e16 - 0.5), (1e16 + 0.5),
(-1e16 - 1.5), (1e16 + 1.5);
SELECT a, ROUND(a) FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -436,5 +436,14 @@ select @my_uuid_date - @my_uuid_synthetic;
set @@session.time_zone=@save_tz;
#
# Bug#42014: Crash, name_const with collate
#
CREATE TABLE t1 (a DATE);
SELECT * FROM t1 WHERE a = NAME_CONST('reportDate',
_binary'2009-01-09' COLLATE 'binary');
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -151,4 +151,22 @@ select timediff('2008-09-29 20:10:10','2008-09-30 20:10:10')<time('00:00:00');
SELECT CAST(time('-73:42:12') AS DECIMAL);
#
# Bug#42525 - TIMEDIFF function
#
SELECT TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1Eq,
TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1NEq1,
TIMEDIFF(TIME('18:00:00'),TIME('17:00:00'))=TIME('00:00:00') AS 1NEq2,
TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))= '00:00:00' AS 2Eq,
TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))= '00:00:00' AS 2NEq1,
TIMEDIFF(TIME('18:00:00'),TIME('17:00:00'))= '00:00:00' AS 2NEq2,
TIMEDIFF(TIME('17:00:00'),TIME('17:00:00'))=TIME(0) AS 3Eq,
TIMEDIFF(TIME('17:59:00'),TIME('17:00:00'))=TIME(0) AS 3NEq1,
TIMEDIFF(TIME('18:00:00'),TIME('17:00:00'))=TIME(0) AS 3NEq2,
TIME(0) AS Time0, TIME('00:00:00') AS Time00, '00:00:00' AS Literal0000,
TIMEDIFF(TIME('17:59:00'),TIME('17:00:00')),
TIMEDIFF(TIME('17:00:00'),TIME('17:59:00'));
# End of 5.0 tests

View File

@ -1159,4 +1159,13 @@ select format(a, 2) from t1;
--disable_metadata
drop table t1;
#
# Bug #41868: crash or memory overrun with concat + upper, date_format functions
#
CREATE TABLE t1 (c DATE, aa VARCHAR(30));
INSERT INTO t1 VALUES ('2008-12-31','aaaaaa');
SELECT DATE_FORMAT(c, GET_FORMAT(DATE, 'eur')) h, CONCAT(UPPER(aa),', ', aa) i FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -355,6 +355,9 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904
# due to fused multiply-add instructions.
--replace_result 36.3310176346904 36.3310176346905
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;

View File

@ -3,6 +3,9 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Cleanup
--disable_warnings
drop table if exists t1;
@ -78,7 +81,7 @@ delete from mysql.db where user='mysqltest_1';
delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_1@localhost;
#
@ -116,15 +119,15 @@ drop table t1;
#
# Test some error conditions
#
--error 1221
--error ER_WRONG_USAGE
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
select 1; # To test that the previous command didn't cause problems
select 1; # To test that the previous command didn't cause problems
#
# Bug #4898: User privileges depending on ORDER BY Settings of table db
# Bug#4898 User privileges depending on ORDER BY Settings of table db
#
insert into mysql.user (host, user) values ('localhost', 'test11');
insert into mysql.db (host, db, user, select_priv) values
insert into mysql.db (host, db, user, select_priv) values
('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
alter table mysql.db order by db asc;
flush privileges;
@ -136,7 +139,7 @@ delete from mysql.user where user='test11';
delete from mysql.db where user='test11';
#
# Bug#6123: GRANT USAGE inserts useless Db row
# Bug#6123 GRANT USAGE inserts useless Db row
#
create database mysqltest1;
grant usage on mysqltest1.* to test6123 identified by 'magic123';
@ -145,7 +148,7 @@ delete from mysql.user where user='test6123';
drop database mysqltest1;
#
# Test for 'drop user', 'revoke privileges, grant'
# Test for 'drop user', 'revoke privileges, grant'
#
create table t1 (a int);
@ -160,7 +163,7 @@ grant select(a) on test.t1 to drop_user@localhost;
show grants for drop_user@localhost;
#
# Bug3086
# Bug#3086 SHOW GRANTS doesn't follow ANSI_QUOTES
#
set sql_mode=ansi_quotes;
show grants for drop_user@localhost;
@ -178,7 +181,7 @@ show grants for drop_user@localhost;
revoke all privileges, grant option from drop_user@localhost;
show grants for drop_user@localhost;
drop user drop_user@localhost;
--error 1269
--error ER_REVOKE_GRANTS
revoke all privileges, grant option from drop_user@localhost;
grant select(a) on test.t1 to drop_user1@localhost;
@ -188,10 +191,10 @@ grant select on *.* to drop_user4@localhost;
# Drop user now implicitly revokes all privileges.
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
--error 1269
--error ER_REVOKE_GRANTS
revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
drop_user3@localhost, drop_user4@localhost;
--error 1396
--error ER_CANNOT_USER
drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
drop_user4@localhost;
drop table t1;
@ -201,12 +204,12 @@ show grants for mysqltest_1@localhost;
drop user mysqltest_1@localhost;
#
# Bug #3403 Wrong encodin in SHOW GRANTS output
# Bug#3403 Wrong encoding in SHOW GRANTS, EXPLAIN SELECT output
#
SET NAMES koi8r;
CREATE DATABASE <20><>;
USE <20><>;
CREATE TABLE <20><><EFBFBD> (<28><><EFBFBD> int);
CREATE TABLE <20><><EFBFBD> (<28><><EFBFBD> INT);
GRANT SELECT ON <20><>.* TO <20><><EFBFBD><EFBFBD>@localhost;
SHOW GRANTS FOR <20><><EFBFBD><EFBFBD>@localhost;
@ -227,7 +230,7 @@ DROP DATABASE
SET NAMES latin1;
#
# Bug #5831: REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
# Bug#5831 REVOKE ALL PRIVILEGES, GRANT OPTION does not revoke everything
#
USE test;
CREATE TABLE t1 (a int );
@ -296,7 +299,7 @@ DROP DATABASE testdb9;
DROP DATABASE testdb10;
#
# Bug #6932: a problem with 'revoke ALL PRIVILEGES'
# Bug#6932 a problem with 'revoke ALL PRIVILEGES'
#
create table t1(a int, b int, c int, d int);
@ -310,7 +313,7 @@ drop user grant_user@localhost;
drop table t1;
#
# Bug#7391: Cross-database multi-table UPDATE security problem
# Bug#7391 Cross-database multi-table UPDATE security problem
#
create database mysqltest_1;
create database mysqltest_2;
@ -319,36 +322,36 @@ create table mysqltest_1.t2 select 1 b, 2 r;
create table mysqltest_2.t1 select 1 c, 2 s;
create table mysqltest_2.t2 select 1 d, 2 t;
#test the column privileges
# test the column privileges
grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
connect (conn1,localhost,mysqltest_3,,);
connection conn1;
SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
SELECT * from INFORMATION_SCHEMA.SCHEMA_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_SCHEMA,PRIVILEGE_TYPE;
SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
WHERE GRANTEE = '''mysqltest_3''@''localhost'''
ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
#the following two should work
# the following two should work
update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
connection master;
@ -359,7 +362,7 @@ revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
#test the db/table level privileges
# test the db/table level privileges
grant all on mysqltest_2.* to mysqltest_3@localhost;
grant select on *.* to mysqltest_3@localhost;
# Next grant is needed to trigger bug#7391. Do not optimize!
@ -371,17 +374,17 @@ connection conn2;
use mysqltest_1;
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
# the following failed before, should fail now.
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
use mysqltest_2;
#the following used to succeed, it must fail now.
--error 1142
# the following used to succeed, it must fail now.
--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
#lets see the result
# lets see the result
connection master;
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
@ -393,6 +396,7 @@ delete from mysql.columns_priv where user="mysqltest_3";
flush privileges;
drop database mysqltest_1;
drop database mysqltest_2;
disconnect conn2;
#
# just SHOW PRIVILEGES test
@ -400,7 +404,7 @@ drop database mysqltest_2;
SHOW PRIVILEGES;
#
# Rights for renaming test (Bug #3270)
# Rights for renaming test (Bug#3270)
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
@ -411,16 +415,18 @@ create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
-- error 1142
-- error ER_TABLEACCESS_DENIED_ERROR
alter table t1 rename t2;
disconnect user1;
connection root;
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
connection default;
disconnect root;
#
# check all new table priveleges
# check all new table privileges
#
CREATE USER dummy@localhost;
CREATE DATABASE mysqltest;
@ -485,7 +491,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost;
DROP USER dummy@localhost;
DROP DATABASE mysqltest;
#
# Bug #11330: Entry in tables_priv with host = '' causes crash
# Bug#11330 Entry in tables_priv with host = '' causes crash
#
connection default;
use mysql;
@ -496,7 +502,7 @@ flush privileges;
use test;
#
# Bug #10892 user variables not auto cast for comparisons
# Bug#10892 user variables not auto cast for comparisons
# Check that we don't get illegal mix of collations
#
set @user123="non-existent";
@ -515,18 +521,18 @@ show grants for root@localhost;
set names latin1;
#
# Bug #15598 Server crashes in specific case during setting new password
# Bug#15598 Server crashes in specific case during setting new password
# - Caused by a user with host ''
#
create user mysqltest_7@;
set password for mysqltest_7@ = password('systpass');
show grants for mysqltest_7@;
drop user mysqltest_7@;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_7@;
#
# Bug#14385: GRANT and mapping to correct user account problems
# Bug#14385 GRANT and mapping to correct user account problems
#
create database mysqltest;
use mysqltest;
@ -542,7 +548,7 @@ flush privileges;
drop database mysqltest;
#
# Bug #27515: DROP previlege is not required for RENAME TABLE
# Bug#27515 DROP previlege is not required for RENAME TABLE
#
connection master;
create database db27515;
@ -553,7 +559,7 @@ grant insert, create on db27515.t2 to user27515@localhost;
connect (conn27515, localhost, user27515, , db27515);
connection conn27515;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
rename table t1 to t2;
disconnect conn27515;
@ -565,7 +571,7 @@ drop database db27515;
--echo End of 4.1 tests
#
# Bug #16297 In memory grant tables not flushed when users's hostname is ""
# Bug#16297 In memory grant tables not flushed when users's hostname is ""
#
use test;
create table t1 (a int);
@ -582,11 +588,11 @@ create user mysqltest_8;
create user mysqltest_8@host8;
# Try to create them again
--error 1396
--error ER_CANNOT_USER
create user mysqltest_8@'';
--error 1396
--error ER_CANNOT_USER
create user mysqltest_8;
--error 1396
--error ER_CANNOT_USER
create user mysqltest_8@host8;
select user, QUOTE(host) from mysql.user where user="mysqltest_8";
@ -681,44 +687,43 @@ flush privileges;
show grants for mysqltest_8@'';
show grants for mysqltest_8;
drop user mysqltest_8@'';
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_8@'';
show grants for mysqltest_8;
select * from information_schema.user_privileges
where grantee like "'mysqltest_8'%";
drop user mysqltest_8;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (conn6,localhost,mysqltest_8,,);
connection master;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_8;
drop user mysqltest_8@host8;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_8@host8;
# Restore the anonymous users.
insert into mysql.user select * from t2;
flush privileges;
drop table t2;
drop table t1;
#
# Bug#20214: Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view
# Bug#20214 Incorrect error when user calls SHOW CREATE VIEW on non
# privileged view
#
connection master;
CREATE DATABASE mysqltest3;
use mysqltest3;
USE mysqltest3;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
CREATE DATABASE mysqltest2;
use mysqltest2;
USE mysqltest2;
CREATE TABLE t_nn (c1 INT);
CREATE VIEW v_nn AS SELECT * FROM t_nn;
@ -740,24 +745,18 @@ SHOW CREATE VIEW mysqltest2.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_nn;
# fail because of missing SHOW VIEW
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest2.v_yn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest2.v_yn;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE TABLE mysqltest2.v_ny;
# succeed (despite of missing SELECT, having SHOW VIEW bails us out)
SHOW CREATE VIEW mysqltest2.v_ny;
# fail because of missing (specific or generic) SELECT
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.t_nn;
@ -766,16 +765,12 @@ SHOW CREATE TABLE mysqltest3.t_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.t_nn;
# fail because of missing missing (specific or generic) SELECT (and SHOW VIEW)
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE VIEW mysqltest3.v_nn;
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE mysqltest3.v_nn;
# succeed thanks to generic SELECT
SHOW CREATE TABLE mysqltest2.t_nn;
@ -783,17 +778,13 @@ SHOW CREATE TABLE mysqltest2.t_nn;
--error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn;
# succeed, have SELECT and SHOW VIEW
SHOW CREATE VIEW mysqltest2.v_yy;
# succeed, have SELECT and SHOW VIEW
SHOW CREATE TABLE mysqltest2.v_yy;
#clean-up
# clean-up
connection master;
# succeed, we're root
@ -806,38 +797,30 @@ SHOW CREATE TABLE mysqltest2.t_nn;
--error ER_WRONG_OBJECT
SHOW CREATE VIEW mysqltest2.t_nn;
DROP VIEW mysqltest2.v_nn;
DROP VIEW mysqltest2.v_yn;
DROP VIEW mysqltest2.v_ny;
DROP VIEW mysqltest2.v_yy;
DROP TABLE mysqltest2.t_nn;
DROP DATABASE mysqltest2;
DROP VIEW mysqltest3.v_nn;
DROP TABLE mysqltest3.t_nn;
DROP DATABASE mysqltest3;
disconnect mysqltest_1;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'mysqltest_1'@'localhost';
DROP USER 'mysqltest_1'@'localhost';
# restore the original database
use test;
USE test;
#
# Bug #10668: CREATE USER does not enforce username length limit
# Bug#10668 CREATE USER does not enforce username length limit
#
--error ER_WRONG_STRING_LENGTH
create user mysqltest1_thisisreallytoolong;
#
# Test for BUG#16899: Possible buffer overflow in handling of DEFINER-clause.
# Test for Bug#16899 Possible buffer overflow in handling of DEFINER-clause.
#
# These checks are intended to ensure that appropriate errors are risen when
# illegal user name or hostname is specified in user-clause of GRANT/REVOKE
@ -887,7 +870,7 @@ REVOKE EXECUTE ON PROCEDURE p1 FROM 1234567890abcdefGHIKL@localhost;
REVOKE EXECUTE ON PROCEDURE t1 FROM some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY;
#
# Bug #6774: Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
# Bug#6774 Replication fails with Wrong usage of DB GRANT and GLOBAL PRIVILEGES
#
# Check if GRANT ... ON * ... fails when no database is selected
connect (con1, localhost, root,,*NO-ONE*);
@ -899,7 +882,7 @@ connection default;
#
# BUG#9504: Stored procedures: execute privilege doesn't make 'use database'
# Bug#9504 Stored procedures: execute privilege doesn't make 'use database'
# okay.
#
@ -924,8 +907,8 @@ CREATE PROCEDURE mysqltest2.p_inv() SQL SECURITY INVOKER
SELECT 1;
CREATE FUNCTION mysqltest3.f_def() RETURNS INT SQL SECURITY DEFINER
RETURN 1;
RETURN 1;
CREATE FUNCTION mysqltest4.f_inv() RETURNS INT SQL SECURITY INVOKER
RETURN 1;
@ -981,7 +964,7 @@ DROP USER mysqltest_1@localhost;
#
# BUG#27337: Privileges are not restored properly.
# Bug#27337 Privileges are not restored properly.
#
# Actually, the patch for this bugs fixes two problems. So, here are two test
# cases.
@ -1043,7 +1026,7 @@ DROP DATABASE mysqltest2;
DROP USER mysqltest_1@localhost;
# Test case 2: priveleges are not checked properly for prepared statements.
# Test case 2: privileges are not checked properly for prepared statements.
# Prepare.
@ -1116,6 +1099,7 @@ EXECUTE stmt2;
--echo
--echo ---> connection: default
--disconnect bug27337_con1
--disconnect bug27337_con2
DROP DATABASE mysqltest1;
@ -1125,21 +1109,21 @@ DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
#
# Bug#27878: Unchecked privileges on a view referring to a table from another
# database.
# Bug#27878 Unchecked privileges on a view referring to a table from another
# database.
#
use test;
USE test;
CREATE TABLE t1 (f1 int, f2 int);
INSERT INTO t1 VALUES(1,1), (2,2);
CREATE DATABASE db27878;
GRANT UPDATE(f1) ON t1 TO 'mysqltest_1'@'localhost';
GRANT SELECT ON `test`.* TO 'mysqltest_1'@'localhost';
GRANT ALL ON db27878.* TO 'mysqltest_1'@'localhost';
use db27878;
USE db27878;
CREATE SQL SECURITY INVOKER VIEW db27878.v1 AS SELECT * FROM test.t1;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
use db27878;
USE db27878;
--error 1356
UPDATE v1 SET f2 = 4;
SELECT * FROM test.t1;
@ -1150,11 +1134,11 @@ REVOKE SELECT ON `test`.* FROM 'mysqltest_1'@'localhost';
REVOKE ALL ON db27878.* FROM 'mysqltest_1'@'localhost';
DROP USER mysqltest_1@localhost;
DROP DATABASE db27878;
use test;
USE test;
DROP TABLE t1;
#
# Bug #33201 Crash occurs when granting update privilege on one column of a view
# Bug#33201 Crash occurs when granting update privilege on one column of a view
#
drop table if exists test;
drop function if exists test_function;
@ -1183,3 +1167,7 @@ SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin");
SET PASSWORD FOR CURRENT_USER() = PASSWORD("");
--echo End of 5.0 tests
disconnect master;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,10 @@
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
SET NAMES binary;
#
@ -27,7 +31,7 @@ create user mysqltest_2@localhost;
connect (user_a,localhost,mysqltest_1,,);
connection user_a;
grant select on `my\_1`.* to mysqltest_2@localhost;
--error 1132
--error ER_PASSWORD_NOT_ALLOWED
grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass';
disconnect user_a;
connection default;
@ -61,7 +65,7 @@ connect (user1,localhost,mysqltest_1,,);
connection user1;
select current_user();
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;
#
@ -72,7 +76,7 @@ select @@sql_mode;
#
# GRANT without IDENTIFIED BY does not create new users
#
--error 1133
--error ER_PASSWORD_NO_MATCH
grant select on `my\_1`.* to mysqltest_4@localhost with grant option;
grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass'
with grant option;
@ -80,7 +84,7 @@ disconnect user1;
connection default;
show grants for mysqltest_1@localhost;
show grants for mysqltest_2@localhost;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for mysqltest_3@localhost;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
@ -95,7 +99,7 @@ connect (user2,localhost,mysqltest_1,,);
connection user2;
select current_user();
show databases;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
grant all privileges on `mysqltest_1`.* to mysqltest_1@localhost with grant option;
disconnect user2;
connection default;
@ -106,8 +110,8 @@ drop database mysqltest_1;
flush privileges;
#
# Bug #6173: One can circumvent missing UPDATE privilege if he has SELECT
# and INSERT privilege for table with primary key
# Bug#6173 One can circumvent missing UPDATE privilege if he has SELECT and
# INSERT privilege for table with primary key
#
create database mysqltest;
grant INSERT, SELECT on mysqltest.* to mysqltest_1@localhost;
@ -119,10 +123,10 @@ connect (mrbad, localhost, mysqltest_1,,mysqltest);
connection mrbad;
show grants for current_user();
insert into t1 values (1, 'I can''t change it!');
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update t1 set data='I can change it!' where id = 1;
# This should not be allowed since it too require UPDATE privilege.
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
insert into t1 values (1, 'XXX') on duplicate key update data= 'I can change it!';
select * from t1;
disconnect mrbad;
@ -138,9 +142,9 @@ create table t1 (a int, b int);
grant select (a) on t1 to mysqltest_1@localhost with grant option;
connect (mrugly, localhost, mysqltest_1,,mysqltest);
connection mrugly;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
grant select (a,b) on t1 to mysqltest_2@localhost;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
grant select on t1 to mysqltest_3@localhost;
disconnect mrugly;
@ -157,7 +161,7 @@ use test;
#
# Bug #15775: "drop user" command does not refresh acl_check_hosts
# Bug#15775 "drop user" command does not refresh acl_check_hosts
#
# Create some test users
@ -188,15 +192,15 @@ disconnect con9;
connection default;
#
# Bug# 16180 - Setting SQL_LOG_OFF without SUPER privilege is silently ignored
# Bug#16180 Setting SQL_LOG_OFF without SUPER privilege is silently ignored
#
create database mysqltest_1;
grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
connect (con10,localhost,mysqltest_1,,);
connection con10;
--error 1227
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set sql_log_off = 1;
--error 1227
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set sql_log_bin = 0;
disconnect con10;
connection default;
@ -217,7 +221,7 @@ create table t2(c1 int, c2 int);
#
# Three forms of CREATE USER
create user 'mysqltest_1';
--error 1396
--error ER_CANNOT_USER
create user 'mysqltest_1';
create user 'mysqltest_2' identified by 'Mysqltest-2';
create user 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
@ -238,7 +242,7 @@ select host,user,password from mysql.user where user like 'mysqltest_%' order by
select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user;
select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name;
select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
#
# Rename
@ -249,7 +253,7 @@ select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest
select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name;
show grants for 'mysqltest_1';
drop user 'mysqltest_1', 'mysqltest_3';
--error 1396
--error ER_CANNOT_USER
drop user 'mysqltest_1';
#
# Cleanup
@ -258,9 +262,9 @@ drop table t1, t2;
# Add a stray record
insert into mysql.db set user='mysqltest_1', db='%', host='%';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
--error 1269
--error ER_REVOKE_GRANTS
revoke all privileges, grant option from 'mysqltest_1';
drop user 'mysqltest_1';
select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user;
@ -268,7 +272,7 @@ select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,us
# Add a stray record
insert into mysql.tables_priv set host='%', db='test', user='mysqltest_1', table_name='t1';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
drop user 'mysqltest_1';
select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' order by host,db,user,table_name;
@ -276,7 +280,7 @@ select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1'
# Add a stray record
insert into mysql.columns_priv set host='%', db='test', user='mysqltest_1', table_name='t1', column_name='c1';
flush privileges;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for 'mysqltest_1';
drop user 'mysqltest_1';
select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' order by host,db,user,table_name,column_name;
@ -286,23 +290,23 @@ create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
create user 'mysqltest_1', 'mysqltest_2' identified by 'Mysqltest-2', 'mysqltest_3' identified by password 'fffffffffffffffffffffffffffffffffffffffff';
rename user 'mysqltest_1' to 'mysqltest_1a', 'mysqltest_2' TO 'mysqltest_2a', 'mysqltest_3' TO 'mysqltest_3a';
--error 1396
--error ER_CANNOT_USER
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
drop user 'mysqltest_1a', 'mysqltest_2a', 'mysqltest_3a';
#
# Let one of multiple users fail
create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
--error 1396
--error ER_CANNOT_USER
create user 'mysqltest_1a', 'mysqltest_2', 'mysqltest_3a';
--error 1396
--error ER_CANNOT_USER
rename user 'mysqltest_1a' to 'mysqltest_1b', 'mysqltest_2a' TO 'mysqltest_2b', 'mysqltest_3a' TO 'mysqltest_3b';
drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3';
--error 1396
--error ER_CANNOT_USER
drop user 'mysqltest_1b', 'mysqltest_2b', 'mysqltest_3b';
#
# Obsolete syntax has been dropped
create user 'mysqltest_2' identified by 'Mysqltest-2';
--error 1064
--error ER_PARSE_ERROR
drop user 'mysqltest_2' identified by 'Mysqltest-2';
drop user 'mysqltest_2';
#
@ -312,7 +316,7 @@ show grants for '%@b'@'b';
grant select on mysql.* to '%@b'@'b';
show grants for '%@b'@'b';
rename user '%@b'@'b' to '%@a'@'a';
--error 1141
--error ER_NONEXISTING_GRANT
show grants for '%@b'@'b';
show grants for '%@a'@'a';
drop user '%@a'@'a';
@ -323,7 +327,7 @@ create user mysqltest_2@localhost;
grant create user on *.* to mysqltest_2@localhost;
connect (user3,localhost,mysqltest_2,,);
connection user3;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
create user mysqltest_A@'%';
rename user mysqltest_A@'%' to mysqltest_B@'%';
@ -338,7 +342,7 @@ grant INSERT,DELETE,UPDATE on mysql.* to mysqltest_3@localhost;
connect (user4,localhost,mysqltest_3,,);
connection user4;
show grants;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password;
insert into mysql.user set host='%', user='mysqltest_B';
create user mysqltest_A@'%';
@ -349,7 +353,7 @@ disconnect user4;
connection default;
drop user mysqltest_3@localhost;
#
# Bug #3309: Test IP addresses with netmask
# Bug#3309 Test IP addresses with netmask
set @@sql_mode='';
create database mysqltest_1;
create table mysqltest_1.t1 (i int);
@ -367,7 +371,8 @@ flush privileges;
drop table mysqltest_1.t1;
#
# Bug #12302: 'SET PASSWORD = ...' didn't work if connecting hostname !=
# Bug#12302 Hostname resolution preventing password changes
# 'SET PASSWORD = ...' didn't work if connecting hostname !=
# hostname the current user is authenticated as. Note that a test for this
# was also added to the test above.
#
@ -400,7 +405,7 @@ drop database mysqltest_1;
# But anonymous users can't change their password
connect (n5,localhost,test,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection n5;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
set password = password("changed");
disconnect n5;
connection default;
@ -408,7 +413,7 @@ connection default;
--source include/delete_anonymous_users.inc
# Bug #12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# Bug#12423 "Deadlock when doing FLUSH PRIVILEGES and GRANT in
# multi-threaded environment". We should be able to execute FLUSH
# PRIVILEGES and SET PASSWORD simultaneously with other account
# management commands (such as GRANT and REVOKE) without causing
@ -474,12 +479,13 @@ connect (con1,localhost,mysqltest_1,password,TESTDB);
# The user mysqltest_1 should only be allowed access to
# database TESTDB, not TEStdb
# On system with "lowercase names" we get error "1007: Can't create db..."
--error 1044, 1007
# On system with "lowercase names" we get error "ER_DB_CREATE_EXISTS: Can't create db..."
--error ER_DBACCESS_DENIED_ERROR, ER_DB_CREATE_EXISTS
create database TEStdb;
# Clean-up
connection default;
disconnect con1;
delete from mysql.user;
delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB';
insert into mysql.user select * from t1;
@ -488,35 +494,34 @@ drop database TESTDB;
flush privileges;
#
# BUG#13310 incorrect user parsing by SP
# Bug#13310 incorrect user parsing by SP
#
grant all privileges on test.* to `a@`@localhost;
grant execute on * to `a@`@localhost;
GRANT ALL PRIVILEGES ON test.* TO `a@`@localhost;
GRANT EXECUTE ON * TO `a@`@localhost;
connect (bug13310,localhost,'a@',,test);
connection bug13310;
create table t2 (s1 int);
insert into t2 values (1);
CREATE TABLE t2 (s1 INT);
INSERT INTO t2 VALUES (1);
--disable_warnings
drop function if exists f2;
DROP FUNCTION IF EXISTS f2;
--enable_warnings
delimiter //;
create function f2 () returns int begin declare v int; select s1 from t2
into v; return v; end//
CREATE FUNCTION f2 () RETURNS INT
BEGIN DECLARE v INT; SELECT s1 FROM t2 INTO v; RETURN v; END//
delimiter ;//
select f2();
SELECT f2();
drop function f2;
drop table t2;
DROP FUNCTION f2;
DROP TABLE t2;
disconnect bug13310;
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
DROP USER `a@`@localhost;
#
# Bug#25578 "CREATE TABLE LIKE does not require any privileges on source table"
# Bug#25578 CREATE TABLE LIKE does not require any privileges on source table
#
--disable_warnings
drop database if exists mysqltest_1;
@ -535,7 +540,7 @@ create table t1 (i int);
connect (user1,localhost,mysqltest_u1,,mysqltest_1);
connection user1;
# As expected error is emitted
--error ER_TABLEACCESS_DENIED_ERROR
--error ER_TABLEACCESS_DENIED_ERROR
show create table mysqltest_2.t1;
# This should emit error as well
--error ER_TABLEACCESS_DENIED_ERROR
@ -550,14 +555,16 @@ create table t1 like mysqltest_2.t1;
# Clean-up
connection default;
disconnect user1;
use test;
drop database mysqltest_1;
drop database mysqltest_2;
drop user mysqltest_u1@localhost;
#
# Bug#18660 Can't grant any privileges on single table in database
# with underscore char
# with underscore char
#
grant all on `mysqltest\_%`.* to mysqltest_1@localhost with grant option;
grant usage on *.* to mysqltest_2@localhost;
@ -571,7 +578,7 @@ grant create on `mysqltest\_1`.* to mysqltest_2@localhost;
grant select on mysqltest_1.t1 to mysqltest_2@localhost;
connect (con3,localhost,mysqltest_2,,);
connection con3;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
create database mysqltest_3;
use mysqltest_1;
create table t2(f1 int);
@ -579,6 +586,9 @@ select * from t1;
connection default;
drop database mysqltest_1;
connection default;
disconnect con3;
disconnect con18600_1;
revoke all privileges, grant option from mysqltest_1@localhost;
revoke all privileges, grant option from mysqltest_2@localhost;
drop user mysqltest_1@localhost;
@ -586,7 +596,7 @@ drop user mysqltest_2@localhost;
#
# Bug #30468: column level privileges not respected when joining tables
# Bug#30468 column level privileges not respected when joining tables
#
CREATE DATABASE db1;
@ -597,7 +607,7 @@ INSERT INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 (b INT, c INT);
INSERT INTO t2 VALUES (1,100),(2,200);
GRANT SELECT ON t1 TO mysqltest1@localhost;
GRANT SELECT ON t1 TO mysqltest1@localhost;
GRANT SELECT (b) ON t2 TO mysqltest1@localhost;
connect (conn1,localhost,mysqltest1,,);
@ -605,13 +615,14 @@ connection conn1;
USE db1;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT c FROM t2;
--error ER_COLUMNACCESS_DENIED_ERROR
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM t2;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT * FROM t1 JOIN t2 USING (b);
connection default;
disconnect conn1;
USE test;
DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
DROP DATABASE db1;
@ -619,3 +630,5 @@ DROP DATABASE db1;
--echo End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,10 @@
# Can't run with embedded server
# Can't run with embedded server because we use GRANT
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Test of GRANT commands
SET NAMES binary;
@ -23,10 +27,11 @@ grant create user on *.* to mysqltest_1@localhost;
grant select on `my\_1`.* to mysqltest_1@localhost with grant option;
connect (user_a,localhost,mysqltest_1,,);
connection user_a;
--error 1410
--error ER_CANT_CREATE_USER_WITH_GRANT
grant select on `my\_1`.* to mysqltest_2@localhost;
create user mysqltest_2@localhost;
disconnect user_a;
disconnect master;
connection default;
delete from mysql.user where user like 'mysqltest\_%';
@ -36,7 +41,7 @@ delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
#
# Bug: #19828 Case sensitivity in Grant/Revoke
# Bug#19828 Case sensitivity in Grant/Revoke
#
grant select on test.* to CUser@localhost;
@ -137,7 +142,7 @@ DROP USER CUser2@LOCALHOST;
#
# Bug#31194: Privilege ordering does not order properly for wildcard values
# Bug#31194 Privilege ordering does not order properly for wildcard values
#
CREATE DATABASE mysqltest_1;
@ -160,3 +165,6 @@ DROP DATABASE mysqltest_1;
--echo End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -311,3 +311,76 @@ explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and
show status like 'Last_query_cost';
drop table t1,t2,t3,t4,t5,t6,t7;
#
# Bug # 38795: Automatic search depth and nested join's results in server
# crash
#
CREATE TABLE t1 (a int, b int, d int, i int); INSERT INTO t1 VALUES (1,1,1,1);
CREATE TABLE t2 (b int, c int, j int); INSERT INTO t2 VALUES (1,1,1);
CREATE TABLE t2_1 (j int); INSERT INTO t2_1 VALUES (1);
CREATE TABLE t3 (c int, f int); INSERT INTO t3 VALUES (1,1);
CREATE TABLE t3_1 (f int); INSERT INTO t3_1 VALUES (1);
CREATE TABLE t4 (d int, e int, k int); INSERT INTO t4 VALUES (1,1,1);
CREATE TABLE t4_1 (k int); INSERT INTO t4_1 VALUES (1);
CREATE TABLE t5 (g int, d int, h int, l int); INSERT INTO t5 VALUES (1,1,1,1);
CREATE TABLE t5_1 (l int); INSERT INTO t5_1 VALUES (1);
SET optimizer_search_depth = 3;
SELECT 1
FROM t1
LEFT JOIN (
t2 JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
SELECT 1
FROM t1
LEFT JOIN (
t2 LEFT JOIN (t3 JOIN t3_1 ON t3.f = t3_1.f) ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
SELECT 1
FROM t1
LEFT JOIN (
(t2 JOIN t2_1 ON t2.j = t2_1.j) JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
SELECT 1
FROM t1
LEFT JOIN (
t2 JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
(t4 JOIN t4_1 ON t4.k = t4_1.k) LEFT JOIN t5 ON t5.d = t4.d
) ON t4.d = t1.d
;
SELECT 1
FROM t1
LEFT JOIN (
t2 JOIN t3 ON t3.c = t2.c
) ON t2.b = t1.b
LEFT JOIN (
t4 LEFT JOIN (t5 JOIN t5_1 ON t5.l = t5_1.l) ON t5.d = t4.d
) ON t4.d = t1.d
;
SET optimizer_search_depth = DEFAULT;
DROP TABLE t1,t2,t2_1,t3,t3_1,t4,t4_1,t5,t5_1;
--echo End of 5.0 tests

View File

@ -935,3 +935,26 @@ insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
select * from t1;
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
drop table t1;
#
# Bug #41610: key_infix_len can be overwritten causing some group by queries
# to return no rows
#
CREATE TABLE t1 (a int, b int, c int, d int,
KEY foo (c,d,a,b), KEY bar (c,a,b,d));
INSERT INTO t1 VALUES (1, 1, 1, 1), (1, 1, 1, 2), (1, 1, 1, 3), (1, 1, 1, 4);
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT a,b,c+1,d FROM t1;
#Should be non-empty
--ordered_result
EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4;
SELECT DISTINCT c FROM t1 WHERE d=4;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -432,3 +432,14 @@ select f1 from t1 having max(f1)=f1;
select f1 from t1 group by f1 having max(f1)=f1;
set session sql_mode='';
drop table t1;
#
# Bug #38637: COUNT DISTINCT prevents NULL testing in HAVING clause
#
CREATE TABLE t1 ( a INT, b INT);
INSERT INTO t1 VALUES (1, 1), (2,2), (3, NULL);
SELECT b, COUNT(DISTINCT a) FROM t1 GROUP BY b HAVING b is NULL;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -36,11 +36,11 @@ insert into t5 values (10);
create view v1 (c) as select table_name from information_schema.TABLES;
select * from v1;
select c,table_name from v1
select c,table_name from v1
inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
select c,table_name from v1
select c,table_name from v1
left join information_schema.TABLES v2 on (v1.c=v2.table_name)
where v1.c like "t%";
@ -69,7 +69,7 @@ grant select (a) on mysqltest.t1 to mysqltest_2@localhost;
grant select on mysqltest.v1 to mysqltest_3;
connect (user3,localhost,mysqltest_2,,);
connection user3;
select table_name, column_name, privileges from information_schema.columns
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 't1';
show columns from mysqltest.t1;
connect (user4,localhost,mysqltest_3,,mysqltest);
@ -77,6 +77,7 @@ connection user4;
select table_name, column_name, privileges from information_schema.columns
where table_schema = 'mysqltest' and table_name = 'v1';
connection default;
disconnect user4;
drop view v1, mysqltest.v1;
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
@ -126,7 +127,7 @@ delimiter ;|
#
# Bug#7222 information_schema: errors in "routines"
#
select parameter_style, sql_data_access, dtd_identifier
select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
--replace_column 5 # 6 #
@ -145,7 +146,7 @@ select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
select count(*) from information_schema.ROUTINES;
create view v1 as select routine_schema, routine_name from information_schema.routines
create view v1 as select routine_schema, routine_name from information_schema.routines
order by routine_schema, routine_name;
select * from v1;
drop view v1;
@ -153,7 +154,7 @@ drop view v1;
connect (user1,localhost,mysqltest_1,,);
connection user1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
--error 1305
--error ER_SP_DOES_NOT_EXIST
show create function sub1;
connection user3;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
@ -172,6 +173,7 @@ show create function sub2;
show function status like "sub2";
connection default;
disconnect user1;
disconnect user3;
drop function sub2;
show create procedure sel2;
@ -311,7 +313,7 @@ drop view v1;
create table t1(a NUMERIC(5,3), b NUMERIC(5,1), c float(5,2),
d NUMERIC(6,4), e float, f DECIMAL(6,3), g int(11), h DOUBLE(10,3),
i DOUBLE);
select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
select COLUMN_NAME,COLUMN_TYPE, CHARACTER_MAXIMUM_LENGTH,
CHARACTER_OCTET_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE
from information_schema.columns where table_name= 't1';
drop table t1;
@ -324,7 +326,7 @@ drop table t115;
delimiter //;
create procedure p108 () begin declare c cursor for select data_type
from information_schema.columns; open c; open c; end;//
--error 1325
--error ER_SP_CURSOR_ALREADY_OPEN
call p108()//
delimiter ;//
drop procedure p108;
@ -334,24 +336,24 @@ where table_name= "user";
select * from v1;
drop view v1;
create view vo as select 'a' union select 'a';
create view vo as select 'a' union select 'a';
show index from vo;
select * from information_schema.TABLE_CONSTRAINTS where
TABLE_NAME= "vo";
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
TABLE_NAME= "vo";
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
from information_schema.tables
where table_schema='information_schema' limit 2;
show tables from information_schema like "T%";
--error 1044
--error ER_DBACCESS_DENIED_ERROR
create database information_schema;
use information_schema;
show full tables like "T%";
--error 1109
--error ER_UNKNOWN_TABLE
create table t1(a int);
use test;
show tables;
@ -359,15 +361,15 @@ use information_schema;
show tables like "T%";
#
# Bug#7210: information_schema: can't access when table-name = reserved word
# Bug#7210 information_schema: can't access when table-name = reserved word
#
select table_name from tables where table_name='user';
select column_name, privileges from columns
where table_name='user' and column_name like '%o%';
#
# Bug#7212: information_schema: "Can't find file" errors if storage engine gone
# Bug#7211: information_schema: crash if bad view
# Bug#7212 information_schema: "Can't find file" errors if storage engine gone
# Bug#7211 information_schema: crash if bad view
#
use test;
create function sub1(i int) returns int
@ -394,9 +396,9 @@ drop view v3;
drop table t4;
#
# Bug#7213: information_schema: redundant non-standard TABLE_NAMES table
# Bug#7213 information_schema: redundant non-standard TABLE_NAMES table
#
--error 1109
--error ER_UNKNOWN_TABLE
select * from information_schema.table_names;
#
@ -409,7 +411,7 @@ where table_schema="information_schema" and table_name="COLUMNS" and
#
# Bug#2718 information_schema: errors in "tables"
#
select TABLE_ROWS from information_schema.tables where
select TABLE_ROWS from information_schema.tables where
table_schema="information_schema" and table_name="COLUMNS";
select table_type from information_schema.tables
where table_schema="mysql" and table_name="user";
@ -422,14 +424,14 @@ show status where variable_name like "%database%";
show variables where variable_name like "skip_show_databas";
#
# Bug #7981:SHOW GLOBAL STATUS crashes server
# Bug#7981 SHOW GLOBAL STATUS crashes server
#
# We don't actually care about the value, just that it doesn't crash.
--replace_column 2 #
show global status like "Threads_running";
#
# Bug #7915 crash,JOIN VIEW, subquery,
# Bug#7915 crash,JOIN VIEW, subquery,
# SELECT .. FROM INFORMATION_SCHEMA.COLUMNS
#
create table t1(f1 int);
@ -440,7 +442,7 @@ drop view v1;
drop table t1, t2;
#
# Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
# Bug#7476 crash on SELECT * FROM INFORMATION_SCHEMA.TABLES
#
CREATE TABLE t_crashme ( f1 BIGINT);
@ -468,26 +470,26 @@ drop view a2, a1;
drop table t_crashme;
#
# Bug #7215 information_schema: columns are longtext instead of varchar
# Bug #7217 information_schema: columns are varbinary() instead of timestamp
# Bug#7215 information_schema: columns are longtext instead of varchar
# Bug#7217 information_schema: columns are varbinary() instead of timestamp
#
select table_schema,table_name, column_name from
information_schema.columns
information_schema.columns
where data_type = 'longtext';
select table_name, column_name, data_type from information_schema.columns
where data_type = 'datetime';
#
# Bug #8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
# Bug#8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
#
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
WHERE NOT EXISTS
WHERE NOT EXISTS
(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
AND A.TABLE_NAME = B.TABLE_NAME);
#
# Bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns
# Bug#9344 INFORMATION_SCHEMA, wrong content, numeric columns
#
create table t1
@ -505,21 +507,22 @@ WHERE TABLE_NAME= 't1';
drop table t1;
#
# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
# Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user
#
grant select on test.* to mysqltest_4@localhost;
connect (user10261,localhost,mysqltest_4,,);
connection user10261;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME';
connection default;
disconnect user10261;
delete from mysql.user where user='mysqltest_4';
delete from mysql.db where user='mysqltest_4';
flush privileges;
#
# Bug #9404 information_schema: Weird error messages
# Bug#9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;
@ -560,7 +563,7 @@ drop table t1;
#
# Bug #10964 Information Schema:Authorization check on privilege tables is improper
# Bug#10964 Information Schema:Authorization check on privilege tables is improper
#
create database mysqltest;
@ -604,12 +607,16 @@ select * from information_schema.user_privileges where grantee like '%user%'
order by grantee;
show grants;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;
use test;
drop database mysqltest;
#
# Bug #11055 information_schema: routines.sql_data_access has wrong value
# Bug#11055 information_schema: routines.sql_data_access has wrong value
#
--disable_warnings
drop procedure if exists p1;
@ -624,13 +631,13 @@ drop procedure p1;
drop procedure p2;
#
# Bug #9434 SHOW CREATE DATABASE information_schema;
# Bug#9434 SHOW CREATE DATABASE information_schema;
#
show create database information_schema;
#
# Bug #11057 information_schema: columns table has some questionable contents
# Bug #12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
# Bug#11057 information_schema: columns table has some questionable contents
# Bug#12301 information_schema: NUMERIC_SCALE must be 0 for integer columns
#
create table t1(f1 LONGBLOB, f2 LONGTEXT);
select column_name,data_type,CHARACTER_OCTET_LENGTH,
@ -646,7 +653,7 @@ where table_name='t1';
drop table t1;
#
# Bug #12127 triggers do not show in info_schema before they are used if set to the database
# Bug#12127 triggers do not show in info_schema before they are used if set to the database
#
create table t1 (f1 integer);
create trigger tr1 after insert on t1 for each row set @test_var=42;
@ -668,8 +675,8 @@ show columns from t1;
drop table t1;
#
# Bug #12636: SHOW TABLE STATUS with where condition containing a subquery
# over information schema
# Bug#12636 SHOW TABLE STATUS with where condition containing a subquery
# over information schema
#
CREATE TABLE t1 (a int);
@ -683,7 +690,7 @@ SHOW TABLE STATUS FROM test
DROP TABLE t1,t2;
#
# Bug #12905 show fields from view behaving erratically with current database
# Bug#12905 show fields from view behaving erratically with current database
#
create table t1(f1 int);
create view v1 (c) as select f1 from t1;
@ -691,28 +698,29 @@ connect (con5,localhost,root,,*NO-ONE*);
select database();
show fields from test.v1;
connection default;
disconnect con5;
drop view v1;
drop table t1;
#
# Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
# Bug#9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
#
--error ER_PARSE_ERROR
alter database information_schema;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database information_schema;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop table information_schema.tables;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
alter table information_schema.tables;
#
# Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
# Bug#9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
#
use information_schema;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
create temporary table schemata(f1 char(10));
#
# Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
# Bug#10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
#
delimiter |;
--error ER_BAD_DB_ERROR
@ -721,13 +729,13 @@ BEGIN
SELECT 'foo' FROM DUAL;
END |
delimiter ;|
select ROUTINE_NAME from routines;
select ROUTINE_NAME from routines;
#
# Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema
# Bug#10734 Grant of privileges other than 'select' and 'create view' should fail on schema
#
--error 1044
--error ER_DBACCESS_DENIED_ERROR
grant all on information_schema.* to 'user1'@'localhost';
--error 1044
--error ER_DBACCESS_DENIED_ERROR
grant select on information_schema.* to 'user1'@'localhost';
#
@ -753,9 +761,9 @@ where table_name="v1";
drop view v1;
#
# Bug #14387 SHOW COLUMNS doesn't work on temporary tables
# Bug #15224 SHOW INDEX from temporary table doesn't work
# Bug #12770 DESC cannot display the info. about temporary table
# Bug#14387 SHOW COLUMNS doesn't work on temporary tables
# Bug#15224 SHOW INDEX from temporary table doesn't work
# Bug#12770 DESC cannot display the info. about temporary table
#
create temporary table t1(f1 int, index(f1));
show columns from t1;
@ -839,6 +847,7 @@ connection con16681;
select * from information_schema.views
where table_name='v1' or table_name='v2';
connection default;
disconnect con16681;
drop view v1, v2;
drop table t1;
drop user mysqltest_1@localhost;
@ -855,7 +864,7 @@ drop table t1,t2;
#
# Bug#20230: routine_definition is not null
# Bug#20230 routine_definition is not null
#
--disable_warnings
DROP PROCEDURE IF EXISTS p1;
@ -888,7 +897,7 @@ DROP PROCEDURE p1;
DROP USER mysql_bug20230@localhost;
#
# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
# Bug#18925 subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
#
SELECT t.table_name, c1.column_name
@ -921,8 +930,8 @@ SELECT t.table_name, c1.column_name
);
#
# Bug#21231: query with a simple non-correlated subquery over
# INFORMARTION_SCHEMA.TABLES
# Bug#2123 query with a simple non-correlated subquery over
# INFORMARTION_SCHEMA.TABLES
#
SELECT MAX(table_name) FROM information_schema.tables;
@ -931,7 +940,7 @@ SELECT table_name from information_schema.tables
FROM information_schema.tables);
#
# Bug #23037: Bug in field "Default" of query "SHOW COLUMNS FROM table"
# Bug#23037 Bug in field "Default" of query "SHOW COLUMNS FROM table"
#
# Note, MyISAM/InnoDB can't take more that 65532 chars, because the row
# size is limited to 65535 bytes (BLOBs not counted)
@ -972,7 +981,7 @@ DROP TABLE bug23037;
DROP FUNCTION get_value;
#
# Bug#22413: EXPLAIN SELECT FROM view with ORDER BY yield server crash
# Bug#22413 EXPLAIN SELECT FROM view with ORDER BY yield server crash
#
create view v1 as
select table_schema as object_schema,
@ -998,7 +1007,7 @@ drop table t1,t2;
#
# Bug#24630 Subselect query crashes mysqld
# Bug#24630 Subselect query crashes mysqld
#
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
(select cast(table_name as char) from information_schema.tables
@ -1033,8 +1042,8 @@ show global status like "Uptime_%"; # Almost certainly zero
#
create table t1(f1 int);
create view v1 as select f1+1 as a from t1;
create table t2 (f1 int, f2 int);
create view v2 as select f1+1 as a, f2 as b from t2;
create table t2 (f1 int, f2 int);
create view v2 as select f1+1 as a, f2 as b from t2;
select table_name, is_updatable from information_schema.views;
#
# Note: we can perform 'delete' for non updatable view.
@ -1044,7 +1053,7 @@ drop view v1,v2;
drop table t1,t2;
#
# Bug#25859 ALTER DATABASE works w/o parameters
# Bug#25859 ALTER DATABASE works w/o parameters
#
--error ER_PARSE_ERROR
alter database;
@ -1073,6 +1082,7 @@ show triggers;
select trigger_name from information_schema.triggers
where event_object_table='t1';
connection default;
disconnect con27629;
drop user mysqltest_1@localhost;
drop database mysqltest;
@ -1116,13 +1126,13 @@ select * from `information_schema`.`VIEWS` where `TABLE_NAME` = NULL;
#
# Bug#30079 A check for "hidden" I_S tables is flawed
#
--error 1109
--error ER_UNKNOWN_TABLE
show fields from information_schema.table_names;
--error 1109
--error ER_UNKNOWN_TABLE
show keys from information_schema.table_names;
#
# Bug#34529: Crash on complex Falcon I_S select after ALTER .. PARTITION BY
# Bug#34529 Crash on complex Falcon I_S select after ALTER .. PARTITION BY
#
USE information_schema;
SET max_heap_table_size = 16384;
@ -1131,9 +1141,9 @@ CREATE TABLE test.t1( a INT );
# What we need to create here is a bit of a corner case:
# We need a star query with information_schema tables, where the first
# branch of the star join produces zero rows, so that reading of the
# branch of the star join produces zero rows, so that reading of the
# second branch never happens. At the same time we have to make sure
# that data for at least the last table is swapped from MEMORY/HEAP to
# that data for at least the last table is swapped from MEMORY/HEAP to
# MyISAM. This and only this triggers the bug.
SELECT *
FROM tables ta

View File

@ -5,6 +5,9 @@
# should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--source include/add_anonymous_users.inc
connect (con0,localhost,root,,);
@ -233,7 +236,8 @@ connect (con1,localhost,mysqltest1,,);
connection con1;
select * from t1;
connection con0;
connection default;
disconnect con0;
disconnect con1;
drop trigger trg1;
@ -244,3 +248,7 @@ set global init_connect="set @a='a\\0c'";
revoke all privileges, grant option from mysqltest1@localhost;
drop user mysqltest1@localhost;
drop table t1, t2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,77 @@
#
# Testcase for InnoDB
# Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections
#
--source include/have_innodb.inc
let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1);
if (`SELECT $innodb_lock_wait_timeout < 10`)
{
--echo # innodb_lock_wait_timeout must be >= 10 seconds
--echo # so that this test can work all time fine on an overloaded testing box
SHOW VARIABLES LIKE 'innodb_lock_wait_timeout';
exit;
}
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# First session
connection default;
--enable_warnings
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);
COMMIT;
SET AUTOCOMMIT = 0;
CREATE TEMPORARY TABLE t1_tmp ( b INT );
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 3;
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 2;
# Second session
connect (user2,localhost,root,,,$MASTER_MYPORT,$MASTER_MYSOCK);
SET AUTOCOMMIT = 0;
CREATE TEMPORARY TABLE t2_tmp ( a int, new_a int );
INSERT INTO t2_tmp VALUES (1,51),(2,52),(3,53);
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 1;
send
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 2;
# The last update will wait for a lock held by the first session
# First session
connection default;
# Poll till the UPDATE of the second session waits for lock
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Updating';
--source include/wait_show_condition.inc
# If the testing box is overloadeded and innodb_lock_wait_timeout is too small
# we might get here ER_LOCK_WAIT_TIMEOUT.
--error ER_LOCK_DEADLOCK
INSERT INTO t1_tmp (b) SELECT b FROM t1 WHERE a = 1;
# Second session
connection user2;
--echo Reap the server message for connection user2 UPDATE t1 ...
reap;
# The server crashed when executing this UPDATE or the succeeding SQL command.
UPDATE t1 SET a = (SELECT new_a FROM t2_tmp WHERE t2_tmp.a = t1.a) WHERE a = 3;
connection default;
disconnect user2;
DROP TABLE t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,4 +1,8 @@
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t2;
--enable_warnings
@ -14,12 +18,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 write;
connection writer;
send update low_priority t1 set n = 4;
send
update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
send
select n from t1;
connection locker;
--sleep 2
# Sleep a bit till the select of connection reader is in work and hangs
# Here we cannot use include/wait_show_condition.inc because this routine
# cannot count the number of 'Locked' sessions or access two columns within
# the same query_get_value call.
--sleep 3
unlock tables;
connection writer;
reap;
@ -32,12 +47,23 @@ create table t1(n int);
insert into t1 values (1);
lock tables t1 read;
connection writer;
send update low_priority t1 set n = 4;
send
update low_priority t1 set n = 4;
connection reader;
--sleep 2
send select n from t1;
# Sleep a bit till the update of connection writer is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
#
send
select n from t1;
connection locker;
--sleep 2
# Sleep a bit till the select of connection reader is in work and hangs
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
#
unlock tables;
connection writer;
reap;
@ -58,10 +84,13 @@ insert into t1 values(2,2);
insert into t2 values(1,2);
lock table t1 read;
connection writer;
--sleep 2
send update t1,t2 set c=a where b=d;
send
update t1,t2 set c=a where b=d;
connection reader;
--sleep 2
# Sleep a bit till the update of connection writer is finished
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
#
select c from t2;
connection writer;
reap;
@ -70,7 +99,7 @@ drop table t1;
drop table t2;
#
# Test problem when using locks on many tables and droping a table that
# Test problem when using locks on many tables and dropping a table that
# is to-be-locked by another thread
#
@ -79,11 +108,18 @@ create table t1 (a int);
create table t2 (a int);
lock table t1 write, t2 write;
connection reader;
send insert t1 select * from t2;
send
insert t1 select * from t2;
connection locker;
# Sleep a bit till the insert of connection reader is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
drop table t2;
connection reader;
--error 1146
--error ER_NO_SUCH_TABLE
reap;
connection locker;
drop table t1;
@ -91,7 +127,7 @@ drop table t1;
# End of 4.1 tests
#
# BUG#9998 - MySQL client hangs on USE "database"
# Bug#9998 MySQL client hangs on USE "database"
#
create table t1(a int);
lock tables t1 write;
@ -102,7 +138,7 @@ unlock tables;
drop table t1;
#
# Bug#19815 - CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
# Bug#19815 CREATE/RENAME/DROP DATABASE can deadlock on a global read lock
#
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
@ -114,12 +150,18 @@ FLUSH TABLES WITH READ LOCK;
# With bug in place: acquire LOCK_mysql_create_table and
# wait in wait_if_global_read_lock().
connection con2;
send DROP DATABASE mysqltest_1;
--sleep 1
send
DROP DATABASE mysqltest_1;
#
# With bug in place: try to acquire LOCK_mysql_create_table...
# When fixed: Reject dropping db because of the read lock.
connection con1;
# Wait a bit so that the session con2 is in state "Waiting for release of readlock"
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Waiting for release of readlock';
--source include/wait_show_condition.inc
--error ER_CANT_UPDATE_WITH_READLOCK
DROP DATABASE mysqltest_1;
UNLOCK TABLES;
@ -135,26 +177,33 @@ disconnect con2;
--error ER_DB_DROP_EXISTS
DROP DATABASE mysqltest_1;
#
# Bug#16986 - Deadlock condition with MyISAM tables
# Bug#16986 Deadlock condition with MyISAM tables
#
# Need a matching user in mysql.user for multi-table select
--source include/add_anonymous_users.inc
connection locker;
use mysql;
USE mysql;
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
FLUSH TABLES;
--sleep 1
#
connection reader;
use mysql;
#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
--sleep 1
USE mysql;
# Note: This must be a multi-table select, otherwise the deadlock will not occur
send
SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
#
connection locker;
# Sleep a bit till the select of connection reader is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
# Make test case independent from earlier grants.
--replace_result "Table is already up to date" "OK"
OPTIMIZE TABLES columns_priv, db, host, user;
@ -162,7 +211,7 @@ UNLOCK TABLES;
#
connection reader;
reap;
use test;
USE test;
#
connection locker;
use test;
@ -177,11 +226,17 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
send FLUSH TABLES WITH READ LOCK;
--sleep 1
send
FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
CREATE TABLE t2 (c1 int);
UNLOCK TABLES;
#
@ -201,12 +256,18 @@ LOCK TABLE t1 WRITE;
#
# This waits until t1 is unlocked.
connection locker;
send FLUSH TABLES WITH READ LOCK;
--sleep 1
send
FLUSH TABLES WITH READ LOCK;
#
# This must not block.
connection writer;
--error 1100
# Sleep a bit till the flush of connection locker is in work and hangs
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Flushing tables';
--source include/wait_show_condition.inc
--error ER_TABLE_NOT_LOCKED
CREATE TABLE t2 AS SELECT * FROM t1;
UNLOCK TABLES;
#
@ -220,8 +281,9 @@ DROP TABLE t1;
--source include/delete_anonymous_users.inc
#
# Bug #17264: MySQL Server freeze
# Bug#17264 MySQL Server freeze
#
connection locker;
# Disable warnings to allow test to run also without InnoDB
@ -230,17 +292,29 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
--enable_warnings
lock tables t1 write;
connection writer;
--sleep 2
# mleich: I have doubts if the next sleep is really necessary
# Therefore I set it to comment but don't remove it
# in case it hat to be enabled again.
# --sleep 2
delimiter //;
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
send
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection reader;
--sleep 2
# Wait till connection writer is blocked
let $wait_timeout= 5;
let $show_statement= SHOW PROCESSLIST;
let $field= State;
let $condition= = 'Locked';
--source include/wait_show_condition.inc
delimiter //;
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
send
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
delimiter ;//
connection locker;
--sleep 2
# Wait till connection reader is blocked
# Here we cannot use include/wait_show_condition.inc.
--sleep 3
unlock tables;
connection writer;
reap;
@ -263,7 +337,7 @@ lock tables t1 read;
--echo connection: writer
connection writer;
let $ID= `select connection_id()`;
--send create table t2 like t1;
send create table t2 like t1;
--echo connection: default
connection default;
let $show_type= open tables where in_use=2 and name_locked=1;
@ -282,8 +356,8 @@ connection default;
drop table t1;
#
# Bug #38691: segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
#
--connection default
@ -354,7 +428,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@ -362,11 +436,11 @@ while ($i) {
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,1054
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
@ -379,7 +453,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
@ -388,11 +462,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,1054
--error 0,ER_BAD_FIELD_ERROR
--reap
}
@ -400,8 +474,9 @@ while ($i) {
--connection default
DROP TABLE t1, t2, t3;
#
# Bug#38499: flush tables and multitable table update with derived table cause
# Bug#38499: flush tables and multitable table update with derived table cause
# crash
#
@ -460,7 +535,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@ -468,11 +543,11 @@ while ($i) {
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # unknown column error
--error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap
}
--enable_query_log
@ -485,7 +560,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@ -494,11 +569,11 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@ -557,7 +632,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
@ -565,11 +640,11 @@ while ($i) {
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
@ -582,7 +657,7 @@ while ($i) {
dec $i;
--connection locker
--error 0,1060
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
@ -591,15 +666,25 @@ while ($i) {
--send EXECUTE stmt
--connection locker
--error 0,1091
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,1054 # Unknown column 'a' in 'field list'
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
DROP TABLE t1;
# Close connections used in many subtests
--disconnect reader
--disconnect locker
--disconnect writer
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,221 @@
# Bug38499 flush tables and multitable table update with derived table cause crash
# MySQL >= 5.0
#
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (locker,localhost,root,,);
connect (writer,localhost,root,,);
--connection default
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1( a INT, b INT );
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4);
--echo # 1. test regular tables
--echo # 1.1. test altering of columns that multiupdate doesn't use
--echo # 1.1.1. normal mode
--disable_query_log
let $i = 100;
while ($i) {
--dec $i
--connection writer
send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--echo # 1.1.2. PS mode
--connection writer
PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0';
let $i = 100;
while ($i) {
--dec $i
--connection writer
--send EXECUTE stmt
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--enable_query_log
--echo # 1.2. test altering of columns that multiupdate uses
--echo # 1.2.1. normal mode
--connection default
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
--connection writer
--send UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0;
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # unknown column error
--reap
}
--enable_query_log
--echo # 1.2.2. PS mode
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
--connection writer
PREPARE stmt FROM 'UPDATE t1, (SELECT 1 FROM t1 t1i) d SET a = 0 WHERE 1=0';
--send EXECUTE stmt
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
ALTER TABLE t1 ADD COLUMN a INT;
--echo # 2. test UNIONs
--echo # 2.1. test altering of columns that multiupdate doesn't use
--echo # 2.1.1. normal mode
--disable_query_log
let $i = 100;
while ($i) {
--dec $i
--connection writer
send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--echo # 2.1.2. PS mode
--connection writer
PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
let $i = 100;
while ($i) {
--dec $i
--connection writer
--send EXECUTE stmt
--connection locker
ALTER TABLE t1 ADD COLUMN (c INT);
ALTER TABLE t1 DROP COLUMN c;
--connection writer
--reap
}
--enable_query_log
--echo # 2.2. test altering of columns that multiupdate uses
--echo # 2.2.1. normal mode
--connection default
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t1 SET a=b;
--connection writer
--send UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0;
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--echo # 2.2.2. PS mode
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t1 ADD COLUMN a INT;
UPDATE t1 SET a=b;
--connection writer
PREPARE stmt FROM 'UPDATE t1, ((SELECT 1 FROM t1 t1i) UNION (SELECT 2 FROM t1 t1ii)) e SET a = 0 WHERE 1=0';
--send EXECUTE stmt
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR # Unknown column 'a' in 'field list'
--reap
}
--enable_query_log
--connection default
DROP TABLE t1;
# Close connections
--disconnect locker
--disconnect writer
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,141 @@
#
# Bug#38691 segfault/abort in ``UPDATE ...JOIN'' while
# ``FLUSH TABLES WITH READ LOCK''
# MySQL >= 5.0
#
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Test to see if select will get the lock ahead of low priority update
connect (locker,localhost,root,,);
connect (writer,localhost,root,,);
--connection default
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
CREATE TABLE t1 (
a int(11) unsigned default NULL,
b varchar(255) default NULL,
UNIQUE KEY a (a),
KEY b (b)
);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
CREATE TABLE t2 SELECT * FROM t1;
CREATE TABLE t3 SELECT * FROM t1;
--echo # test altering of columns that multiupdate doesn't use
--echo # normal mode
--disable_query_log
let $i = 100;
while ($i) {
--dec $i
--connection writer
send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
SET a = NULL WHERE t1.b <> t2.b;
--connection locker
ALTER TABLE t2 ADD COLUMN (c INT);
ALTER TABLE t2 DROP COLUMN c;
--connection writer
--reap
}
--echo # PS mode
--connection writer
PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a)
SET a = NULL WHERE t1.b <> t2.b';
let $i = 100;
while ($i) {
--dec $i
--connection writer
--send EXECUTE stmt
--connection locker
ALTER TABLE t2 ADD COLUMN (c INT);
ALTER TABLE t2 DROP COLUMN c;
--connection writer
--reap
}
--enable_query_log
--echo # test altering of columns that multiupdate uses
--echo # normal mode
--connection default
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
--connection writer
--send UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
--echo # PS mode
--disable_query_log
let $i = 100;
while ($i) {
dec $i;
--connection locker
--error 0,ER_DUP_FIELDNAME
ALTER TABLE t2 ADD COLUMN a int(11) unsigned default NULL;
UPDATE t2 SET a=b;
--connection writer
PREPARE stmt FROM 'UPDATE t2 INNER JOIN (t1 JOIN t3 USING(a)) USING(a) SET a = NULL WHERE t1.b <> t2.b';
--send EXECUTE stmt
--connection locker
--error 0,ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t2 DROP COLUMN a;
--connection writer
--error 0,ER_BAD_FIELD_ERROR
--reap
}
--enable_query_log
--connection default
DROP TABLE t1, t2, t3;
# Close connections
--disconnect locker
--disconnect writer
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,24 +1,33 @@
# This is a test for bug 578
# Test for Bug#578 mysqlimport -l silently fails when binlog-ignore-db is set
-- source include/have_innodb.inc
--source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
connection con1;
--disable_warnings
drop table if exists t1;
create table t1(a int) engine=innodb;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT) ENGINE=innodb;
--enable_warnings
lock tables t1 write;
insert into t1 values(10);
LOCK TABLES t1 WRITE;
INSERT INTO t1 VALUES(10);
disconnect con1;
connection con2;
# The bug was that, because of the LOCK TABLES, the handler "forgot" to commit,
# and the other commit when we write to the binlog was not done because of
# binlog-ignore-db
select * from t1;
drop table t1;
# binlog-ignore-db
SELECT * FROM t1;
DROP TABLE t1;
connection default;
disconnect con2;
# End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1,4 @@
--lower-case-table-names=1 --character-set-server=utf8

View File

@ -0,0 +1,9 @@
#
# Bug#25830 SHOW TABLE STATUS behaves differently depending on table name
#
set names utf8;
create table `А` (id int);
show tables from test like 'А';
show tables from test like 'а';
drop table `А`;

View File

@ -556,4 +556,17 @@ ALTER TABLE m1 UNION=();
SHOW CREATE TABLE m1;
DROP TABLE t1, m1;
#
# BUG#32047 - 'Spurious' errors while opening MERGE tables
#
CREATE TABLE t1(a INT);
CREATE TABLE t2(a VARCHAR(10));
CREATE TABLE m1(a INT) ENGINE=MERGE UNION=(t1, t2);
CREATE TABLE m2(a INT) ENGINE=MERGE UNION=(t1);
SELECT * FROM t1;
--error ER_WRONG_MRG_TABLE
SELECT * FROM m1;
SELECT * FROM m2;
DROP TABLE t1, t2, m1, m2;
--echo End of 5.0 tests

View File

@ -24,17 +24,17 @@ let $1 = 100;
while ($1)
{
let $2 = 5;
eval insert into t1(t) values ('$1');
eval insert into t1(t) values ('$1');
while ($2)
{
eval insert into t2(id2,t) values ($1,'$2');
eval insert into t2(id2,t) values ($1,'$2');
let $3 = 10;
while ($3)
{
eval insert into t3(id3,t) values ($1,'$2');
eval insert into t3(id3,t) values ($1,'$2');
dec $3;
}
dec $2;
dec $2;
}
dec $1;
}
@ -79,11 +79,11 @@ let $1 = 1000;
while ($1)
{
let $2 = 5;
eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa');
eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa');
while ($2)
{
eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
dec $2;
eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
dec $2;
}
dec $1;
}
@ -317,7 +317,7 @@ update t2, t1 set t2.field=t1.field
delete t1, t2 from t2 inner join t1 on t1.id1=t2.id2
where 0=1;
delete t1, t2 from t2,t1
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
@ -351,7 +351,7 @@ create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(1
insert into t1 values (0,'A01-Comp',1);
insert into t1 values (0,'B01-Comp',1);
insert into t2 values (0,1,'A Note',1);
update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2;
select * from t1;
select * from t2;
drop table t1, t2;
@ -379,6 +379,9 @@ revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
connection default;
disconnect user1;
disconnect root;
#
# multi delete wrong table check
@ -393,7 +396,7 @@ drop table t1, t2, t3;
#
# multi* unique updating table check
#
create table t1 (col1 int);
create table t1 (col1 int);
create table t2 (col1 int);
-- error ER_UPDATE_TABLE_USED
update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
@ -401,16 +404,16 @@ update t1,t2 set t1.col1 = (select max(col1) from t1) where t1.col1 = t2.col1;
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
drop table t1,t2;
# Test for BUG#5837 - delete with outer join and const tables
# Test for Bug#5837 delete with outer join and const tables
--disable_warnings
create table t1 (
aclid bigint not null primary key,
status tinyint(1) not null
aclid bigint not null primary key,
status tinyint(1) not null
) engine = innodb;
create table t2 (
refid bigint not null primary key,
aclid bigint, index idx_acl(aclid)
refid bigint not null primary key,
aclid bigint, index idx_acl(aclid)
) engine = innodb;
--enable_warnings
insert into t2 values(1,null);
@ -418,7 +421,7 @@ delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
drop table t1, t2;
#
# Bug#19225: unchecked error leads to server crash
# Bug#19225 unchecked error leads to server crash
#
create table t1(a int);
create table t2(a int);
@ -428,7 +431,7 @@ drop table t1, t2;
# End of 4.1 tests
#
# Test for bug #1980.
# Test for Bug#1980.
#
--disable_warnings
create table t1 ( c char(8) not null ) engine=innodb;
@ -484,9 +487,12 @@ send alter table t1 add column c int default 100 after a;
connect (updater,localhost,root,,test);
connection updater;
# Wait till "alter table t1 ..." is in work.
sleep 2;
send update t1, v1 set t1.b=t1.a+t1.b+v1.b where t1.a=v1.a;
connection locker;
# Wait till "update t1, v1 ..." is in work.
sleep 2;
unlock tables;
@ -500,8 +506,14 @@ select * from t2;
drop view v1;
drop table t1, t2;
connection default;
disconnect locker;
disconnect changer;
disconnect updater;
#
# Bug#27716 multi-update did partially and has not binlogged
# Bug#27716 multi-update did partially and has not binlogged
#
CREATE TABLE `t1` (
@ -536,11 +548,12 @@ reset master;
UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
show master status /* there must be the UPDATE query event */;
# cleanup bug#27716
# cleanup
drop table t1, t2;
#
# Bug #29136 erred multi-delete on trans table does not rollback
# Bug#29136 erred multi-delete on trans table does not rollback
#
# prepare
@ -569,7 +582,7 @@ select count(*) from t3 /* must be 1 */;
# the query must be in binlog (no surprise though)
source include/show_binlog_events.inc;
# cleanup bug#29136
# cleanup
drop table t1, t2, t3;

View File

@ -0,0 +1,45 @@
#
# Bug#41486 extra character appears in BLOB for every ~40Mb after
# mysqldump/import
#
# This test consumes a significant amount of resources.
# Therefore it should be kept separated from other tests.
# Otherwise we might suffer from problems like
# Bug#43801 mysql.test takes too long, fails due to expired timeout
# on debx86-b in PB
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
# Have to change the global variable as the session variable is
# read-only.
SET @old_max_allowed_packet= @@global.max_allowed_packet;
# 2 MB blob length + some space for the rest of INSERT query
SET @@global.max_allowed_packet = 2 * 1024 * 1024 + 1024;
# Create a new connection since the global max_allowed_packet
# has no effect for the current connection
connect (con1, localhost, root,,);
CREATE TABLE t1(data LONGBLOB);
INSERT INTO t1 SELECT REPEAT('1', 2*1024*1024);
let $outfile= $MYSQLTEST_VARDIR/tmp/bug41486.sql;
--error 0,1
remove_file $outfile;
--exec $MYSQL_DUMP test t1 > $outfile
# Check that the mysql client does not insert extra newlines when loading
# strings longer than client's max_allowed_packet
--exec $MYSQL --max_allowed_packet=1M test < $outfile 2>&1
SELECT LENGTH(data) FROM t1;
DROP TABLE t1;
# Cleanup
disconnect con1;
--source include/wait_until_disconnected.inc
remove_file $outfile;
connection default;
SET @@global.max_allowed_packet = @old_max_allowed_packet;

View File

@ -98,35 +98,43 @@ drop table t1;
# Bug #20432: mysql client interprets commands in comments
#
--let $file = $MYSQLTEST_VARDIR/tmp/bug20432.sql
# if the client sees the 'use' within the comment, we haven't fixed
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
--exec echo "/*" > $file
--exec echo "use" >> $file
--exec echo "*/" >> $file
--exec $MYSQL < $file 2>&1
# SQL can have embedded comments => workie
--exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
--exec echo "select /*" > $file
--exec echo "use" >> $file
--exec echo "*/ 1" >> $file
--exec $MYSQL < $file 2>&1
# client commands on the other hand must be at BOL => error
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "/*" > $file
--exec echo "xxx" >> $file
--exec echo "*/ use" >> $file
--error 1
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
--exec $MYSQL < $file 2>&1
# client comment recognized, but parameter missing => error
--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
--exec echo "use" > $file
--exec $MYSQL < $file 2>&1
--remove_file $file
#
# Bug #20328: mysql client interprets commands in comments
#
--exec $MYSQL -e "help" > $MYSQLTEST_VARDIR/tmp/bug20328_1.result
--exec $MYSQL -e "help " > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
--diff_files $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result
--let $file1 = $MYSQLTEST_VARDIR/tmp/bug20328_1.result
--let $file2 = $MYSQLTEST_VARDIR/tmp/bug20328_2.result
--exec $MYSQL -e "help" > $file1
--exec $MYSQL -e "help " > $file2
--diff_files $file1 $file2
--remove_file $file1
--remove_file $file2
#
# Bug #19216: Client crashes on long SELECT
@ -152,13 +160,15 @@ EOF
#
# Bug #20103: Escaping with backslash does not work
#
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SELECT '\';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
--let $file = $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SET SQL_MODE = 'NO_BACKSLASH_ESCAPES';" > $file
--exec echo "SELECT '\';" >> $file
--exec $MYSQL < $file 2>&1
--exec echo "SET SQL_MODE = '';" > $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec echo "SELECT '\';';" >> $MYSQLTEST_VARDIR/tmp/bug20103.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20103.sql 2>&1
--exec echo "SET SQL_MODE = '';" > $file
--exec echo "SELECT '\';';" >> $file
--exec $MYSQL < $file 2>&1
--remove_file $file
#
# Bug#17583: mysql drops connection when stdout is not writable
@ -309,4 +319,26 @@ EOF
--exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql;
#
# Bug #41437: Value stored in 'case' lacks charset, causees segfault
#
--exec $MYSQL -e "select @z:='1',@z=database()"
#
# Bug #31060: MySQL CLI parser bug 2
#
--write_file $MYSQLTEST_VARDIR/tmp/bug31060.sql
;DELIMITER DELIMITER
;
SELECT 1DELIMITER
DELIMITER ;
SELECT 1;
EOF
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug31060.sql 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/bug31060.sql;
--echo End of 5.0 tests

View File

@ -1,5 +1,4 @@
# We are using .opt file since we need small binlog size
-- source include/have_log_bin.inc
# we need this for getting fixed timestamps inside of this test
@ -19,7 +18,7 @@ insert into t2 values ();
# set @a:=1
# insert into t2 values (@a);
# test for load data and load data distributed among the several
# test for load data and load data distributed among the several
# files (we need to fill up first binlog)
load data infile '../std_data_ln/words.dat' into table t1;
load data infile '../std_data_ln/words.dat' into table t1;
@ -104,7 +103,7 @@ select "--- --position --" as "";
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=231 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002
# Bug#7853 (mysqlbinlog does not accept input from stdin)
# Bug#7853 mysqlbinlog does not accept input from stdin
--disable_query_log
select "--- reading stdin --" as "";
--enable_query_log
@ -118,7 +117,7 @@ select "--- reading stdin --" as "";
drop table t1,t2;
#
#BUG#14157: utf8 encoding in binlog without set character_set_client
# Bug#14157 utf8 encoding in binlog without set character_set_client
#
flush logs;
--write_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
@ -131,8 +130,8 @@ EOF
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14157.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug14157.sql
# resulted binlog, parly consisting of multi-byte utf8 chars,
# must be digestable for both client and server. In 4.1 the client
# resulted binlog, parly consisting of multi-byte utf8 chars,
# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
select * from t5 /* must be (1),(1) */;
@ -158,7 +157,7 @@ select * from t5 order by c1;
drop table t5;
#
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
#
--disable_warnings
drop procedure if exists p1;
@ -174,7 +173,7 @@ delimiter ;//
flush logs;
call p1();
drop procedure p1;
--error 1305
--error ER_SP_DOES_NOT_EXIST
call p1();
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
@ -217,40 +216,82 @@ flush logs;
#
# Bug#28293 missed '#' sign in the hex dump when the dump length
# is divisible by 16.
# is divisible by 16.
#
CREATE TABLE t1 (c1 CHAR(10));
# we need this for getting fixed timestamps inside of this test
flush logs;
FLUSH LOGS;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
FLUSH LOGS;
DROP TABLE t1;
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 | grep 'Query' | sed 's/[0-9]\{1,\}/REMOVED/g'
# We create a table, patch, and load the output into it
# By using LINES STARTING BY '#' + SELECT WHERE a LIKE 'Query'
# We can easily see if a 'Query' line is missing the '#' character
# as described in the original bug
--disable_query_log
CREATE TABLE patch (a BLOB);
--exec $MYSQL_BINLOG --hexdump --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000011 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat'
INTO TABLE patch FIELDS TERMINATED BY '' LINES STARTING BY '#';
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_tmp.dat
--enable_query_log
--echo We expect this value to be 1
--echo The bug being tested was that 'Query' lines were not preceded by '#'
--echo If the line is in the table, it had to have been preceded by a '#'
--echo
SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
DROP TABLE patch;
#
# Bug #29928: incorrect connection_id() restoring from mysqlbinlog out
# Bug#29928 incorrect connection_id() restoring from mysqlbinlog out
#
flush logs;
create table t1(a int);
insert into t1 values(connection_id());
let $a= `select a from t1`;
flush logs;
FLUSH LOGS;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES(connection_id());
let $a= `SELECT a FROM t1`;
FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000013 > $MYSQLTEST_VARDIR/tmp/bug29928.sql
drop table t1;
connect (con1, localhost, root, , test);
DROP TABLE t1;
connect (con1, localhost, root, , test);
connection con1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29928.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug29928.sql
let $b= `select a from t1`;
let $b= `SELECT a FROM t1`;
disconnect con1;
connection default;
let $c= `select $a=$b`;
let $c= `SELECT $a=$b`;
--echo $c
drop table t1;
DROP TABLE t1;
echo shell> mysqlbinlog std_data/corrupt-relay-bin.000624 > var/tmp/bug31793.sql;
error 1;
exec $MYSQL_BINLOG $MYSQL_TEST_DIR/std_data/corrupt-relay-bin.000624 > $MYSQLTEST_VARDIR/tmp/bug31793.sql;
remove_file $MYSQLTEST_VARDIR/tmp/bug31793.sql;
#
# Bug#37313 BINLOG Contains Incorrect server id
#
let $binlog_file= $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug37313.binlog;
let $save_server_id= `SELECT @@global.server_id`;
let $s_id_max= `SELECT (1 << 32) - 1`;
eval SET @@global.server_id= $s_id_max;
RESET MASTER;
FLUSH LOGS;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 > $binlog_file
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval SELECT
(@a:=LOAD_FILE("$binlog_file"))
IS NOT NULL;
let $s_id_unsigned= `SELECT @a LIKE "%server id $s_id_max%" /* must return 1 */`;
echo *** Unsigned server_id $s_id_max is found: $s_id_unsigned ***;
eval SET @@global.server_id= $save_server_id;
--remove_file $binlog_file
--echo End of 5.0 tests

View File

@ -5,9 +5,13 @@
# Bug #30126: semicolon before closing */ in /*!... CREATE DATABASE ;*/
#
--let $file = $MYSQLTEST_VARDIR/tmp/bug30126.sql
CREATE DATABASE mysqldump_30126;
USE mysqldump_30126;
CREATE TABLE t1 (c1 int);
--exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $MYSQLTEST_VARDIR/tmp/bug30126.sql
--exec $MYSQL mysqldump_30126 < $MYSQLTEST_VARDIR/tmp/bug30126.sql
--exec $MYSQL_DUMP --add-drop-database mysqldump_30126 > $file
--exec $MYSQL mysqldump_30126 < $file
DROP DATABASE mysqldump_30126;
--remove_file $file

View File

@ -5,10 +5,13 @@
# Binlog is required
--source include/have_log_bin.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--echo Bug#37938 - Test "mysqldump" lacks various insert statements
--echo Turn off concurrent inserts to avoid random errors
--echo NOTE: We reset the variable back to saved value at the end of test
--echo # Bug#37938 Test "mysqldump" lacks various insert statements
--echo # Turn off concurrent inserts to avoid random errors
--echo # NOTE: We reset the variable back to saved value at the end of test
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;
@ -23,13 +26,13 @@ drop view if exists v1, v2, v3;
# XML output
CREATE TABLE t1(a int);
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments -X test t1
DROP TABLE t1;
--echo #
--echo # Bug #2005
--echo # Bug#2005 Long decimal comparison bug.
--echo #
CREATE TABLE t1 (a decimal(64, 20));
@ -39,7 +42,7 @@ INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
DROP TABLE t1;
--echo #
--echo # Bug #2055
--echo # Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
--echo #
CREATE TABLE t1 (a double);
@ -51,7 +54,7 @@ INSERT INTO t1 VALUES ('-9e999999');
DROP TABLE t1;
--echo #
--echo # Bug #3361 mysqldump quotes DECIMAL values inconsistently
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
--echo #
CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);
@ -65,7 +68,7 @@ INSERT INTO t1 VALUES ("1.2345", 2.3456);
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
--error 1054
--error ER_BAD_FIELD_ERROR
INSERT INTO t1 VALUES ("1.2345", 2.3456);
SET SQL_MODE=@OLD_SQL_MODE;
@ -82,7 +85,7 @@ INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
DROP TABLE t1;
--echo #
--echo # Bug #1707
--echo # Bug#1707 mysqldump -X does't quote field and table names
--echo #
CREATE TABLE t1 (`a"b"` char(2));
@ -91,8 +94,8 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
--echo #
--echo # Bug #1994
--echo # Bug #4261
--echo # Bug#1994 mysqldump does not correctly dump UCS2 data
--echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
--echo #
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
@ -101,7 +104,7 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
DROP TABLE t1;
--echo #
--echo # Bug #2634
--echo # Bug#2634 mysqldump in --compatible=mysql4
--echo #
CREATE TABLE t1 (a int) ENGINE=MYISAM;
@ -111,7 +114,7 @@ INSERT INTO t1 VALUES (1), (2);
DROP TABLE t1;
--echo #
--echo # Bug #2592 'mysqldump doesn't quote "tricky" names correctly'
--echo # Bug#2592 mysqldump doesn't quote "tricky" names correctly
--echo #
create table ```a` (i int);
@ -119,7 +122,7 @@ create table ```a` (i int);
drop table ```a`;
--echo #
--echo # Bug #2591 "mysqldump quotes names inconsistently"
--echo # Bug#2591 mysqldump quotes names inconsistently
--echo #
create table t1(a int);
@ -132,7 +135,7 @@ set global sql_mode='';
drop table t1;
--echo #
--echo # Bug #2705 'mysqldump --tab extra output'
--echo # Bug#2705 mysqldump --tab extra output
--echo #
create table t1(a int);
@ -148,7 +151,7 @@ insert into t1 values (1),(2),(3);
drop table t1;
--echo #
--echo # Bug #6101: create database problem
--echo # Bug#6101 create database problem
--echo #
--exec $MYSQL_DUMP --skip-comments --databases test
@ -158,7 +161,7 @@ create database mysqldump_test_db character set latin2 collate latin2_bin;
drop database mysqldump_test_db;
--echo #
--echo # Bug #7020
--echo # Bug#7020 mysqldump --compatible=mysql40 should set --skip-set-charset --default-char...
--echo # Check that we don't dump in UTF8 in compatible mode by default,
--echo # but use the default compiled values, or the values given in
--echo # --default-character-set=xxx. However, we should dump in UTF8
@ -169,8 +172,8 @@ INSERT INTO t1 VALUES (_latin1 '
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments test t1
--echo #
--echo # Bug#8063: make test mysqldump [ fail ]
--echo # We cannot tes this command because its output depends
--echo # Bug#8063 make test mysqldump [ fail ]
--echo # We cannot test this command because its output depends
--echo # on --default-character-set incompiled into "mysqldump" program.
--echo # If the future we can move this command into a separate test with
--echo # checking that "mysqldump" is compiled with "latin1"
@ -183,7 +186,7 @@ INSERT INTO t1 VALUES (_latin1 '
DROP TABLE t1;
--echo #
--echo # WL #2319: Exclude Tables from dump
--echo # WL#2319 Exclude Tables from dump
--echo #
CREATE TABLE t1 (a int);
@ -195,7 +198,7 @@ DROP TABLE t1;
DROP TABLE t2;
--echo #
--echo # Bug #8830
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
--echo #
CREATE TABLE t1 (`b` blob);
@ -207,7 +210,7 @@ DROP TABLE t1;
--echo # Test for --insert-ignore
--echo #
CREATE TABLE t1 (a int);
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --skip-comments --insert-ignore test t1
@ -215,9 +218,9 @@ INSERT INTO t1 VALUES (4),(5),(6);
DROP TABLE t1;
--echo #
--echo # Bug #10286: mysqldump -c crashes on table that has many fields with long
--echo # names
--echo #
--echo # Bug#10286 mysqldump -c crashes on table that has many fields with long
--echo # names
--echo #
create table t1 (
F_c4ca4238a0b923820dcc509a6f75849b int,
F_c81e728d9d4c2f636f067f89cc14862c int,
@ -563,7 +566,7 @@ INSERT INTO t1 VALUES (1),(2),(3);
DROP TABLE t1;
--echo #
--echo # Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
--echo # Bug#9558 mysqldump --no-data db t1 t2 format still dumps data
--echo #
CREATE DATABASE mysqldump_test_db;
@ -582,7 +585,7 @@ DROP DATABASE mysqldump_test_db;
--echo #
--echo # Testing with tables and databases that don't exists
--echo # or contains illegal characters
--echo # (Bug #9358 mysqldump crashes if tablename starts with \)
--echo # (Bug#9358 mysqldump crashes if tablename starts with \)
--echo #
create database mysqldump_test_db;
use mysqldump_test_db;
@ -601,7 +604,7 @@ select '------ Testing with illegal table names ------' as test_sequence ;
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
@ -644,7 +647,7 @@ use test;
--echo #
--echo # Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
--echo # Bug#9657 mysqldump xml ( -x ) does not format NULL fields correctly
--echo #
create table t1 (a int(10));
@ -655,8 +658,9 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir
--exec $MYSQL_DUMP --skip-comments --xml --no-create-info test
drop table t1, t2;
--echo #
--echo # BUG #12123
--echo # Bug#12123 mysqldump --tab results in text file which can't be imported
--echo #
create table t1 (a text character set utf8, b text character set latin1);
@ -669,14 +673,15 @@ select * from t1;
drop table t1;
--echo #
--echo # BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
--echo # Bug#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
--echo #
--exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
--echo #
--echo # BUG #19025 mysqldump doesn't correctly dump "auto_increment = [int]"
--echo # Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]"
--echo #
create table `t1` (
@ -704,9 +709,11 @@ select * from t1;
show create table `t1`;
drop table `t1`;
--remove_file $MYSQLTEST_VARDIR/tmp/bug19025.sql
--echo #
--echo # Bug #18536: wrong table order
--echo # Bug#18536 wrong table order
--echo #
create table t1(a int);
@ -716,8 +723,9 @@ create table t3(a int);
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
--echo #
--echo # Bug #21288: mysqldump segmentation fault when using --where
--echo # Bug#21288 mysqldump segmentation fault when using --where
--echo #
create table t1 (a int);
@ -725,8 +733,9 @@ create table t1 (a int);
--exec $MYSQL_DUMP --skip-comments --force test t1 --where="xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 2>&1
drop table t1;
--echo #
--echo # BUG#13926: --order-by-primary fails if PKEY contains quote character
--echo # Bug#13926 --order-by-primary fails if PKEY contains quote character
--echo #
--disable_warnings
@ -746,8 +755,9 @@ DROP TABLE `t1`;
--echo End of 4.1 tests
--echo #
--echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #
create database db1;
@ -770,8 +780,9 @@ drop view v2;
drop database db1;
use test;
--echo #
--echo # Bug 10713 mysqldump includes database in create view and referenced tables
--echo # Bug#10713 mysqldump includes database in create view and referenced tables
--echo #
# create table and views in db2
@ -805,18 +816,21 @@ select * from t2 order by a;
drop table t1, t2;
drop database db1;
use test;
--remove_file $MYSQLTEST_VARDIR/tmp/bug10713.sql
#
# dump of view
#
create table t1(a int);
create view v1 as select * from t1;
--exec $MYSQL_DUMP --skip-comments test
drop view v1;
drop table t1;
--echo #
--echo # Bug #10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #
create database mysqldump_test_db;
@ -840,7 +854,7 @@ drop database mysqldump_test_db;
use test;
--echo #
--echo # Bug #9756
--echo # Bug#9756 mysql client failing on dumps containing certain \ sequences
--echo #
CREATE TABLE t1 (a char(10));
@ -849,7 +863,7 @@ INSERT INTO t1 VALUES ('\'');
DROP TABLE t1;
--echo #
--echo # Bug #10927 mysqldump: Can't reload dump with view that consist of other view
--echo # Bug#10927 mysqldump: Can't reload dump with view that consist of other view
--echo #
create table t1(a int, b int, c varchar(30));
@ -921,7 +935,9 @@ show triggers;
DROP TABLE t1, t2;
--echo #
--echo # Bugs #9136, #12917: problems with --defaults-extra-file option
--echo # Bug#9136 my_print_defaults changed behaviour between 4.1.7 and 4.1.10a
--echo # Bug#12917 The --defaults-extra-file option is ignored by the 5.0 client binaries
--echo # (Problems with --defaults-extra-file option)
--echo #
--write_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
@ -933,7 +949,7 @@ EOF
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
--echo #
--echo # Test of fix to BUG 12597
--echo # Test of fix to Bug#12597 mysqldump dumps triggers wrongly
--echo #
DROP TABLE IF EXISTS `test1`;
@ -969,9 +985,11 @@ SELECT * FROM `test2`;
DROP TRIGGER testref;
DROP TABLE test1;
DROP TABLE test2;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqldump.sql
--echo #
--echo # BUG#9056 - mysqldump does not dump routines
--echo # Bug#9056 mysqldump does not dump routines
--echo #
--disable_warnings
@ -997,9 +1015,9 @@ begin
return f1;
end //
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
select sum(id) from t1 into a;
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
select sum(id) from t1 into a;
END //
DELIMITER ;//
@ -1008,7 +1026,7 @@ set sql_mode='ansi';
create procedure `a'b` () select 1; # to fix syntax highlighting :')
set sql_mode='';
# Dump the DB and ROUTINES
# Dump the DB and ROUTINES
--exec $MYSQL_DUMP --skip-comments --routines --databases test
# ok, now blow it all away
@ -1019,8 +1037,9 @@ DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`;
drop table t1;
--echo #
--echo # BUG# 13052 - mysqldump timestamp reloads broken
--echo # Bug#13052 mysqldump timestamp reloads broken
--echo #
--disable_warnings
@ -1043,7 +1062,7 @@ set global time_zone=default;
set time_zone=default;
--echo #
--echo # Test of fix to BUG 13146 - ansi quotes break loading of triggers
--echo # Test of fix to Bug#13146 ansi quotes break loading of triggers
--echo #
--disable_warnings
@ -1068,7 +1087,7 @@ INSERT INTO `t1 test` VALUES (1);
INSERT INTO `t1 test` VALUES (2);
INSERT INTO `t1 test` VALUES (3);
SELECT * FROM `t2 test`;
# dump with compatible=ansi. Everything except triggers should be double
# dump with compatible=ansi. Everything except triggers should be double
# quoted
--exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test
@ -1077,7 +1096,7 @@ DROP TABLE `t1 test`;
DROP TABLE `t2 test`;
--echo #
--echo # BUG# 12838 mysqldump -x with views exits with error
--echo # Bug#12838 mysqldump -x with views exits with error
--echo #
--disable_warnings
@ -1101,7 +1120,7 @@ drop view v1;
drop table t1;
--echo #
--echo # BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
--echo # Bug#14554 mysqldump does not separate words "ROW" and "BEGIN"
--echo # for tables with trigger created in the IGNORE_SPACE sql mode.
--echo #
@ -1125,8 +1144,8 @@ DROP TRIGGER tr1;
DROP TABLE t1;
--echo #
--echo # Bug #13318: Bad result with empty field and --hex-blob
--echo #
--echo # Bug#13318 Bad result with empty field and --hex-blob
--echo #
create table t1 (a binary(1), b blob);
insert into t1 values ('','');
@ -1135,7 +1154,7 @@ insert into t1 values ('','');
drop table t1;
--echo #
--echo # Bug 14871 Invalid view dump output
--echo # Bug#14871 Invalid view dump output
--echo #
create table t1 (a int);
@ -1162,9 +1181,11 @@ select * from v3 order by a;
drop table t1;
drop view v1, v2, v3, v4, v5;
--remove_file $MYSQLTEST_VARDIR/tmp/bug14871.sql
--echo #
--echo # Bug #16878 dump of trigger
--echo # Bug#16878 dump of trigger
--echo #
create table t1 (a int, created datetime);
@ -1192,6 +1213,8 @@ show triggers;
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
--remove_file $MYSQLTEST_VARDIR/tmp/bug16878.sql
--echo #
--echo # Bug#18462 mysqldump does not dump view structures correctly
@ -1211,11 +1234,15 @@ create view v2 as select qty from v1;
drop view v1;
drop view v2;
drop table t;
--remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/v2.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t.txt
--echo #
--echo # Bug#14857 Reading dump files with single statement stored routines fails.
--echo # fixed by patch for bug#16878
--echo # fixed by patch for Bug#16878
--echo #
DELIMITER |;
@ -1230,7 +1257,7 @@ drop function f;
drop procedure p;
--echo #
--echo # Bug #17371 Unable to dump a schema with invalid views
--echo # Bug#17371 Unable to dump a schema with invalid views
--echo #
create table t1 ( id serial );
@ -1243,7 +1270,8 @@ drop table t1;
--echo } mysqldump
drop view v1;
--echo # BUG#17201 Spurious 'DROP DATABASE' in output,
--echo # Bug#17201 Spurious 'DROP DATABASE' in output,
--echo # also confusion between tables and views.
--echo # Example code from Markus Popp
@ -1260,8 +1288,9 @@ drop view v1;
drop table t1;
drop database mysqldump_test_db;
--echo #
--echo # Bug21014 Segmentation fault of mysqldump on view
--echo # Bug#21014 Segmentation fault of mysqldump on view
--echo #
create database mysqldump_tables;
@ -1280,7 +1309,7 @@ drop table mysqldump_tables.basetable;
drop database mysqldump_tables;
--echo #
--echo # Bug20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo # Bug#20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo #
create database mysqldump_dba;
@ -1318,6 +1347,7 @@ use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
--remove_file $MYSQLTEST_VARDIR/tmp/bug20221_backup
use test;
--echo #
@ -1363,11 +1393,12 @@ grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
drop table t1;
drop user mysqltest_1@localhost;
--echo #
--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo # Bug#21527 mysqldump incorrectly tries to LOCK TABLES on the
--echo # information_schema database.
--echo #
--echo # Bug #21424 mysqldump failing to export/import views
--echo # Bug#21424 mysqldump failing to export/import views
--echo #
# Do as root
@ -1388,7 +1419,7 @@ create table u1 (f1 int);
insert into u1 values (4);
create view v1 (c1) as select * from t1;
# Backup should not fail for Bug #21527. Flush priviliges test begins.
# Backup should not fail for Bug#21527. Flush priviliges test begins.
--exec $MYSQL_DUMP --skip-comments --add-drop-table --flush-privileges --ignore-table=mysql.general_log --ignore-table=mysql.slow_log --databases mysqldump_myDB mysql > $MYSQLTEST_VARDIR/tmp/bug21527.sql
# Clean up
@ -1402,8 +1433,9 @@ drop user myDB_User@localhost;
drop database mysqldump_myDB;
flush privileges;
--echo # Bug #21424 continues from here.
--echo # Restore. Flush Privileges test ends.
--echo # Bug#21424 continues from here.
--echo # Restore. Flush Privileges test ends.
--echo #
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql
@ -1416,8 +1448,9 @@ use mysqldump_myDB;
select * from mysqldump_myDB.v1;
select * from mysqldump_myDB.u1;
#Final cleanup.
# Final cleanup.
connection root;
disconnect user1;
use mysqldump_myDB;
drop view v1;
drop table t1;
@ -1425,10 +1458,14 @@ drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User@localhost;
drop database mysqldump_myDB;
connection default;
disconnect root;
--remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
use test;
--echo #
--echo # Bug #19745: mysqldump --xml produces invalid xml
--echo # Bug#19745 mysqldump --xml produces invalid xml
--echo #
--disable_warnings
@ -1443,9 +1480,8 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1;
--echo #
--echo # Bug#26346: stack + buffer overrun in mysqldump
--echo # Bug#26346 stack + buffer overrun in mysqldump
--echo #
CREATE TABLE t1(a int);
@ -1466,18 +1502,20 @@ INSERT INTO t1 VALUES (1), (2);
DROP TABLE t1;
#
# Bug #25993: crashe with a merge table and -c
# Bug#25993 crashes with a merge table and -c
#
CREATE TABLE t2 (a int);
CREATE TABLE t3 (a int);
CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
CREATE TABLE t2 (a INT);
CREATE TABLE t3 (a INT);
CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3);
--exec $MYSQL_DUMP --skip-comments -c test
DROP TABLE t1, t2, t3;
--echo #
--echo # Bug #23491: MySQLDump prefix function call in a view by database name
--echo # Bug#23491 MySQLDump prefix function call in a view by database name
--echo #
# Setup
@ -1507,15 +1545,16 @@ show create view bug23491_restore.v3;
drop database bug23491_original;
drop database bug23491_restore;
use test;
--remove_file $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
--echo #
--echo # Bug 27293: mysqldump crashes when dumping routines
--echo # defined by a different user
--echo #
--echo # Bug #22761: mysqldump reports no errors when using
--echo # --routines without mysql.proc privileges
--echo # Bug#27293 mysqldump crashes when dumping routines
--echo # defined by a different user
--echo #
--echo # Bug#22761 mysqldump reports no errors when using
--echo # --routines without mysql.proc privileges
--echo #
create database mysqldump_test_db;
@ -1536,13 +1575,14 @@ create procedure mysqldump_test_db.sp1() select 'hello';
drop procedure sp1;
connection default;
disconnect user27293;
drop user user1;
drop user user2;
drop database mysqldump_test_db;
--echo #
--echo # Bug #28522: buffer overrun by '\0' byte using --hex-blob.
--echo # Bug#28522 buffer overrun by '\0' byte using --hex-blob.
--echo #
CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
@ -1551,8 +1591,8 @@ INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
DROP TABLE t1;
--echo #
--echo # Bug #28524: mysqldump --skip-add-drop-table is not
--echo # compatible with views
--echo # Bug#28524 mysqldump --skip-add-drop-table is not
--echo # compatible with views
--echo #
CREATE VIEW v1 AS SELECT 1;
@ -1562,10 +1602,12 @@ DROP VIEW v1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug28524.sql
SELECT * FROM v1;
DROP VIEW v1;
--remove_file $MYSQLTEST_VARDIR/tmp/bug28524.sql
--echo #
--echo # Bug #29788: mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
--echo # the SQL_MODE variable after the dumping of triggers.
--echo # Bug#29788 mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
--echo # the SQL_MODE variable after the dumping of triggers.
--echo #
CREATE TABLE t1 (c1 INT);
@ -1584,10 +1626,12 @@ SELECT * FROM t2;
SELECT * FROM t2;
DROP TABLE t1,t2;
--remove_file $MYSQLTEST_VARDIR/tmp/bug29788.sql
--echo #
--echo # Bug#29815: new option for suppressing last line of mysqldump:
--echo # "Dump completed on"
--echo # Bug#29815 new option for suppressing last line of mysqldump:
--echo # "Dump completed on"
--echo #
--echo # --skip-dump-date:
@ -1605,7 +1649,42 @@ DROP TABLE t1,t2;
# We reset concurrent_inserts value to whatever it was at the start of the test
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
--echo #
--echo # Bug #42635: mysqldump includes views that were excluded using
--echo # the --ignore-table option
--echo #
create database db42635;
use db42635;
create table t1 (id int);
create view db42635.v1 (c) as select * from db42635.t1;
create view db42635.v2 (c) as select * from db42635.t1;
--exec $MYSQL_DUMP --skip-comments --ignore-table=db42635.v1 db42635
use test;
drop database db42635;
--echo #
--echo # Bug#33550 mysqldump 4.0 compatibility broken
--echo #
SET NAMES utf8;
CREATE TABLE `straße` ( f1 INT );
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
DROP TABLE `straße`;
CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 test
--error 2
--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=latin1 --compatible=mysql323 test
DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`;
SET NAMES latin1;
--echo #
--echo # End of 5.0 tests
--echo #
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -6,6 +6,9 @@
# This test uses chmod, can't be run with root permissions
-- source include/not_as_root.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# ============================================================================
#
# Test of mysqltest itself
@ -50,7 +53,7 @@ select otto from (select 1 as otto) as t1;
# ----------------------------------------------------------------------------
# Negative case(statement):
# The derived table t1 does not contain a column named 'friedrich' .
# The derived table t1 does not contain a column named 'friedrich' .
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
# --> 1054: Unknown column 'friedrich' in 'field list'
# ----------------------------------------------------------------------------
@ -62,7 +65,8 @@ select otto from (select 1 as otto) as t1;
--exec echo "select friedrich from (select 1 as otto) as t1;" | $MYSQL_TEST 2>&1
# expectation = response
--error 1054
--error ER_BAD_FIELD_ERROR
select friedrich from (select 1 as otto) as t1;
# The following unmasked unsuccessful statement must give
@ -116,7 +120,7 @@ select friedrich from (select 1 as otto) as t1;
# $mysql_errno is a builtin variable of mysqltest and contains the return code
# of the last command sent to the server.
#
# The following test cases often initialize $mysql_errno to 1064 by
# The following test cases often initialize $mysql_errno to 1064 by
# a command with wrong syntax.
# Example: --error 1064 To prevent the abort after the error.
# garbage ;
@ -131,14 +135,16 @@ eval select $mysql_errno as "after_successful_stmt_errno" ;
#----------------------------------------------------------------------------
# check mysql_errno = 1064 after statement with wrong syntax
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
eval select $mysql_errno as "after_wrong_syntax_errno" ;
# ----------------------------------------------------------------------------
# check if let $my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
let $my_var= 'abc' ;
eval select $mysql_errno as "after_let_var_equal_value" ;
@ -146,7 +152,8 @@ eval select $mysql_errno as "after_let_var_equal_value" ;
# ----------------------------------------------------------------------------
# check if set @my_var= 'abc' ; affects $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
set @my_var= 'abc' ;
eval select $mysql_errno as "after_set_var_equal_value" ;
@ -155,7 +162,8 @@ eval select $mysql_errno as "after_set_var_equal_value" ;
# check if the setting of --disable-warnings itself affects $mysql_errno
# (May be --<whatever> modifies $mysql_errno.)
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--disable_warnings
eval select $mysql_errno as "after_disable_warnings_command" ;
@ -166,7 +174,8 @@ eval select $mysql_errno as "after_disable_warnings_command" ;
# (May be disabled warnings affect $mysql_errno.)
# ----------------------------------------------------------------------------
drop table if exists t1 ;
--error 1064
--error ER_PARSE_ERROR
garbage ;
drop table if exists t1 ;
eval select $mysql_errno as "after_disable_warnings" ;
@ -175,21 +184,26 @@ eval select $mysql_errno as "after_disable_warnings" ;
# ----------------------------------------------------------------------------
# check if masked errors affect $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_minus_masked" ;
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_!_masked" ;
# ----------------------------------------------------------------------------
# Will manipulations of $mysql_errno be possible and visible ?
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
let $mysql_errno= -1;
eval select $mysql_errno as "after_let_errno_equal_value" ;
@ -198,50 +212,61 @@ eval select $mysql_errno as "after_let_errno_equal_value" ;
# How affect actions on prepared statements $mysql_errno ?
# ----------------------------------------------------------------------------
# failing prepare
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_failing_prepare" ;
create table t1 ( f1 char(10));
# successful prepare
--error 1064
--error ER_PARSE_ERROR
garbage ;
prepare stmt from "select 3 from t1" ;
eval select $mysql_errno as "after_successful_prepare" ;
# successful execute
--error 1064
--error ER_PARSE_ERROR
garbage ;
execute stmt;
eval select $mysql_errno as "after_successful_execute" ;
# failing execute (table has been dropped)
drop table t1;
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1146
--error ER_NO_SUCH_TABLE
execute stmt;
eval select $mysql_errno as "after_failing_execute" ;
# failing execute (unknown statement)
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1243
--error ER_UNKNOWN_STMT_HANDLER
execute __stmt_;
eval select $mysql_errno as "after_failing_execute" ;
# successful deallocate
--error 1064
--error ER_PARSE_ERROR
garbage ;
deallocate prepare stmt;
eval select $mysql_errno as "after_successful_deallocate" ;
# failing deallocate ( statement handle does not exist )
--error 1064
--error ER_PARSE_ERROR
garbage ;
--error 1243
--error ER_UNKNOWN_STMT_HANDLER
deallocate prepare __stmt_;
eval select $mysql_errno as "after_failing_deallocate" ;
@ -266,7 +291,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
# ----------------------------------------------------------------------------
# Switch off the abort on error and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--disable_abort_on_error
eval select $mysql_errno as "after_--disable_abort_on_error" ;
@ -280,9 +306,11 @@ select 3 from t1 ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
eval select $mysql_errno as "after_!errno_masked_error" ;
# expected error <> response
@ -296,7 +324,8 @@ eval select $mysql_errno as "after_!errno_masked_error" ;
# ----------------------------------------------------------------------------
# Switch the abort on error on and check the effect on $mysql_errno
# ----------------------------------------------------------------------------
--error 1064
--error ER_PARSE_ERROR
garbage ;
--enable_abort_on_error
eval select $mysql_errno as "after_--enable_abort_on_error" ;
@ -305,7 +334,8 @@ eval select $mysql_errno as "after_--enable_abort_on_error" ;
# masked failing statements
# ----------------------------------------------------------------------------
# expected error = response
--error 1146
--error ER_NO_SUCH_TABLE
select 3 from t1 ;
# ----------------------------------------------------------------------------
@ -454,7 +484,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/mysqltest.sql;
# Allow trailing # comment
--sleep 1 # Wait for insert delayed to be executed.
--sleep 1 # Wait for insert delayed to be executed.
--sleep 1 # Wait for insert delayed to be executed.
# ----------------------------------------------------------------------------
# Test error
@ -568,9 +598,6 @@ echo ;
# ----------------------------------------------------------------------------
# Illegal use of exec
--error 1
--exec echo "--exec false" | $MYSQL_TEST 2>&1
--error 1
--exec echo "--exec " | $MYSQL_TEST 2>&1
@ -951,8 +978,6 @@ system echo "hej" > /dev/null;
--exec echo "system;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system $NONEXISTSINFVAREABLI;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "system false;" | $MYSQL_TEST 2>&1
--disable_abort_on_error
system NonExistsinfComamdn 2> /dev/null;
@ -1360,7 +1385,7 @@ connection default;
# ----------------------------------------------------------------------------
# TODO Test queries, especially their errormessages... so it's easy to debug
# TODO Test queries, especially their errormessages... so it's easy to debug
# new scripts and diagnose errors
# ----------------------------------------------------------------------------
@ -1370,7 +1395,8 @@ connection default;
let $num= 2;
while ($num)
{
--error 1064
--error ER_PARSE_ERROR
failing_statement;
dec $num;
@ -1401,7 +1427,7 @@ let $message= `SELECT USER()`;
# The message contains more then 80 characters on multiple lines
# and is kept between double quotes.
let $message=
let $message=
"Here comes a very very long message that
- is longer then 80 characters and
- consists of several lines";
@ -1429,14 +1455,14 @@ select "this will be executed";
#
# Test zero length result file. Should not pass
#
--exec touch $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo '' > $MYSQLTEST_VARDIR/tmp/zero_length_file.result
--exec echo "echo ok;" > $MYSQLTEST_VARDIR/tmp/query.sql
--error 1
--exec $MYSQL_TEST -x $MYSQLTEST_VARDIR/tmp/query.sql -R $MYSQLTEST_VARDIR/tmp/zero_length_file.result > /dev/null 2>&1
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.result;
--error 0,1
remove_file $MYSQLTEST_VARDIR/log/zero_length_file.reject;
remove_file $MYSQLTEST_VARDIR/tmp/zero_length_file.reject;
--error 0,1
remove_file $MYSQL_TEST_DIR/r/zero_length_file.reject;
@ -1482,7 +1508,8 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should be non existent
--exec test ! -s $MYSQLTEST_VARDIR/tmp/bug11731.out
--error 1
--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
@ -1503,26 +1530,29 @@ drop table t1;
--exec $MYSQL_TEST --record -x $MYSQLTEST_VARDIR/tmp/bug11731.sql -R $MYSQLTEST_VARDIR/tmp/bug11731.out 2>&1
# The .out file should exist
--exec test -s $MYSQLTEST_VARDIR/tmp/bug11731.out
--file_exists $MYSQLTEST_VARDIR/tmp/bug11731.out
drop table t1;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.out;
remove_file $MYSQLTEST_VARDIR/log/bug11731.log;
remove_file $MYSQLTEST_VARDIR/tmp/bug11731.sql;
#
# Bug#19890 mysqltest: "query" command is broken
# Bug#19890 mysqltest: "query" command is broken
#
# It should be possible to use the command "query" to force mysqltest to
# send the command to the server although it's a builtin mysqltest command.
--error 1064
--error ER_PARSE_ERROR
query sleep;
--error 1064
--error ER_PARSE_ERROR
--query sleep
# Just an empty query command
--error 1065
--error ER_EMPTY_QUERY
query ;
# test for replace_regex
@ -1533,7 +1563,7 @@ select "at" as col1, "c" as col2;
select "at" as col1, "AT" as col2, "c" as col3;
--replace_regex /a/b/ /ct/d/
select "a" as col1, "ct" as col2;
select "a" as col1, "ct" as col2;
--replace_regex /(strawberry)/raspberry and \1/ /blueberry/blackberry/ /potato/tomato/;
select "strawberry","blueberry","potato";
@ -1551,7 +1581,7 @@ select "strawberry","blueberry","potato";
--error 1
--exec echo "--replace_regex /a b c" | $MYSQL_TEST 2>&1
--error 1
--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
--exec echo "replace_regex /a /b c ;" | $MYSQL_TEST 2>&1
# REQUIREMENT
# replace_regex should replace substitutions from left to right in output
@ -1915,12 +1945,13 @@ eval $my_stmt;
# 8. Ensure that "sorted_result " does not change the semantics of
# "--error ...." or the protocol output after such an expected failure
--sorted_result
--error 1146
--error ER_NO_SUCH_TABLE
SELECT '2' as "my_col1",2 as "my_col2"
UNION
SELECT '1',1 from t2;
# 9. Ensure that several result formatting options including "sorted_result"
# 9. Ensure that several result formatting options including "sorted_result"
# - have all an effect
# - "--sorted_result" does not need to be direct before the statement
# - Row sorting is applied after modification of the column content
@ -2126,3 +2157,5 @@ rmdir $MYSQLTEST_VARDIR/tmp/testdir;
--echo End of tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,12 @@
-- source include/have_ndb.inc
-- source include/not_embedded.inc
# Bug#41308: Test main.ndb_autodiscover.test doesn't work on Windows due
# to 'grep' calls
# Test is currently disabled on Windows via the next line until this bug
# can be resolved.
--source include/not_windows.inc
--disable_warnings
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
--enable_warnings

View File

@ -16,3 +16,31 @@ execute stmt1;
deallocate prepare stmt1;
# End of 4.1 tests
#
# Bug#31222: com_% global status counters behave randomly with
# mysql_change_user.
#
FLUSH STATUS;
--disable_result_log
--disable_query_log
let $i = 100;
while ($i)
{
dec $i;
SELECT 1;
}
--enable_query_log
--enable_result_log
SHOW GLOBAL STATUS LIKE 'com_select';
--change_user
SHOW GLOBAL STATUS LIKE 'com_select';

View File

@ -3,6 +3,10 @@
-- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
@ -11,8 +15,8 @@ insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@mysql.com";
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@mysql.com";
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/ST=Uppsala/O=MySQL AB/emailAddress=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/ST=Uppsala/L=Uppsala/O=MySQL AB";
grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges;
@ -21,38 +25,42 @@ connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,,,,SSL);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error 1045
--error ER_ACCESS_DENIED_ERROR
connect (con5,localhost,ssl_user5,,,,,SSL);
connection con1;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con2;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con3;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection con4;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from t1;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
drop user ssl_user1@localhost, ssl_user2@localhost,
ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost;
@ -97,7 +105,7 @@ drop table t1;
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# BUG#21611 Slave can't connect when master-ssl-cipher specified
# Bug#21611 Slave can't connect when master-ssl-cipher specified
# - Apparently selecting a cipher doesn't work at all
# - Usa a cipher that both yaSSL and OpenSSL supports
#
@ -133,7 +141,7 @@ drop table t1;
--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
#
# Bug #27669 mysqldump: SSL connection error when trying to connect
# Bug#27669 mysqldump: SSL connection error when trying to connect
#
CREATE TABLE t1(a int);
@ -152,3 +160,7 @@ INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/test.sql
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,10 @@ eval set @tmpdir="../tmp";
enable_query_log;
-- source include/have_outfile.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# test of into outfile|dumpfile
#
@ -46,7 +50,7 @@ select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
drop table t1;
# Bug#8191
# Bug#8191 SELECT INTO OUTFILE insists on FROM clause
disable_query_log;
eval select 1 into outfile "../tmp/outfile-test.4";
enable_query_log;
@ -54,11 +58,11 @@ select load_file(concat(@tmpdir,"/outfile-test.4"));
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
#
# Bug #5382: 'explain select into outfile' crashes the server
# Bug#5382 'explain select into outfile' crashes the server
#
CREATE TABLE t1 (a INT);
EXPLAIN
EXPLAIN
SELECT *
INTO OUTFILE '/tmp/t1.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
@ -68,7 +72,7 @@ DROP TABLE t1;
# End of 4.1 tests
#
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
#
disable_query_log;
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
@ -114,6 +118,7 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
disconnect con28181_1;
grant file on *.* to user_1@localhost;
connect (con28181_2,localhost,user_1,,mysqltest);
@ -125,9 +130,12 @@ from information_schema.schemata
where schema_name like 'mysqltest';
connection default;
disconnect con28181_2;
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
use test;
revoke all privileges on *.* from user_1@localhost;
drop user user_1@localhost;
drop database mysqltest;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,14 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1,localhost,root,,);
connection con1;
-- error 1064,1102,1280
--error ER_PARSE_ERROR,ER_WRONG_DB_NAME,ER_WRONG_NAME_FOR_INDEX
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
connection default;
disconnect con1;
# End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -4,12 +4,18 @@
# swallowing them and returning an error
--source include/not_windows.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Check protocol handling
#
connect (con1,localhost,root,,);
set @max_allowed_packet=@@global.max_allowed_packet;
set @net_buffer_length=@@global.net_buffer_length;
connect (con1,localhost,root,,);
connection con1;
set global max_allowed_packet=100;
set max_allowed_packet=100;
@ -19,6 +25,8 @@ set net_buffer_length=100;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
# Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000);
connection default;
disconnect con1;
#
# Connection 2 should get error for too big packets
@ -26,7 +34,7 @@ select repeat('a',2000);
connect (con2,localhost,root,,);
connection con2;
select @@net_buffer_length, @@max_allowed_packet;
--error 1153
--error ER_NET_PACKET_TOO_LARGE
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
set global max_allowed_packet=default;
set max_allowed_packet=default;
@ -34,5 +42,13 @@ set global net_buffer_length=default;
set net_buffer_length=default;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000));
connection default;
disconnect con2;
set global max_allowed_packet=@max_allowed_packet;
set global net_buffer_length=@net_buffer_length;
# End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -228,6 +228,10 @@ drop table t1;
# statements or are correctly created and deleted on each execute
#
--let $outfile=$MYSQLTEST_VARDIR/tmp/f1.txt
--error 0,1
--remove_file $outfile
prepare stmt1 from "select 1 into @var";
execute stmt1;
execute stmt1;
@ -238,11 +242,14 @@ execute stmt1;
prepare stmt1 from "insert into t1 select i from t1";
execute stmt1;
execute stmt1;
prepare stmt1 from "select * from t1 into outfile 'f1.txt'";
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval prepare stmt1 from "select * from t1 into outfile '$outfile'";
execute stmt1;
deallocate prepare stmt1;
drop table t1;
--remove_file $outfile
#
# BUG#5242 "Prepared statement names are case sensitive"
#

View File

@ -1276,4 +1276,31 @@ DROP TABLE t1;
SET GLOBAL concurrent_insert= @save_concurrent_insert;
SET GLOBAL query_cache_size= default;
#
# Bug#36326: nested transaction and select
#
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
FLUSH STATUS;
SET GLOBAL query_cache_size=1048576;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SHOW STATUS LIKE 'Qcache_queries_in_cache';
SELECT * FROM t1;
BEGIN;
SELECT * FROM t1;
COMMIT;
SHOW STATUS LIKE 'Qcache_queries_in_cache';
SHOW STATUS LIKE "Qcache_hits";
SELECT * FROM t1;
BEGIN;
SELECT * FROM t1;
COMMIT;
SHOW STATUS LIKE "Qcache_hits";
DROP TABLE t1;
SET GLOBAL query_cache_size= default;
# End of 5.0 tests

View File

@ -1,6 +1,10 @@
-- source include/have_query_cache.inc
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Tests with query cache
#
@ -79,7 +83,7 @@ show status like "Qcache_free_blocks";
drop table t1, t2, t3, t11, t21;
#
# do not use QC if tables locked (BUG#12385)
# do not use QC if tables locked (Bug#12385)
#
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
@ -96,10 +100,13 @@ SELECT * FROM t1;
connection root;
SELECT * FROM t1;
drop table t1;
connection default;
disconnect root;
disconnect root2;
#
# query in QC from normal execution and SP (BUG#6897)
# improved to also test BUG#3583 and BUG#12990
# query in QC from normal execution and SP (Bug#6897)
# improved to also test Bug#3583 and Bug#12990
#
flush query cache;
reset query cache;
@ -181,7 +188,7 @@ drop procedure f4;
drop table t1;
#
# bug#14767: INSERT in SF + concurrent SELECT with query cache
# Bug#14767 INSERT in SF + concurrent SELECT with query cache
#
reset query cache;
--disable_warnings
@ -222,3 +229,8 @@ disconnect con2;
connection default;
set GLOBAL query_cache_size=0;
# End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
# should work with embedded server after mysqltest is fixed
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3;
--enable_warnings
@ -40,24 +43,24 @@ connection con1;
select @@global.read_only;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
create table t3 (a int);
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
# if a statement, after parse stage, looks like it will update a
# non-temp table, it will be rejected, even if at execution it would
# have turned out that 0 rows would be updated
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1 set a=1 where 1=0;
# multi-update is special (see sql_parse.cc) so we test it
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
# check multi-delete to be sure
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
delete t1,t2 from t1,t2 where t1.a=t2.a;
# With temp tables updates should be accepted:
@ -71,7 +74,7 @@ insert into t3 values(1);
insert into t4 select * from t3;
# a non-temp table updated:
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
# no non-temp table updated (just swapped):
@ -79,7 +82,7 @@ update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
delete t1 from t1,t3 where t1.a=t3.a;
delete t3 from t1,t3 where t1.a=t3.a;
@ -98,11 +101,11 @@ delete t1 from t1,t3 where t1.a=t3.a;
drop table t1;
--error 1290
--error ER_OPTION_PREVENTS_STATEMENT
insert into t1 values(1);
#
# BUG #22077 "DROP TEMPORARY TABLE fails with wrong error if read_only is set"
# Bug#22077 DROP TEMPORARY TABLE fails with wrong error if read_only is set
#
# check if DROP TEMPORARY on a non-existing temporary table returns the right
# error
@ -114,11 +117,12 @@ drop temporary table ttt;
drop temporary table if exists ttt;
connection default;
disconnect con1;
drop table t1,t2;
drop user test@localhost;
--echo #
--echo # Bug #27440 read_only allows create and drop database
--echo # Bug#27440 read_only allows create and drop database
--echo #
--disable_warnings
drop database if exists mysqltest_db1;
@ -151,3 +155,7 @@ delete from mysql.columns_priv where User like 'mysqltest_%';
flush privileges;
drop database mysqltest_db1;
set global read_only=0;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -237,3 +237,21 @@ SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
DROP TABLE t1;
#
# Bug#37601 Cast Is Not Done On Row Comparison
#
create table t1 (a varchar(200),
b int unsigned not null primary key auto_increment)
default character set 'utf8';
create table t2 (c varchar(200),
d int unsigned not null primary key auto_increment)
default character set 'latin1';
insert into t1 (a) values('abc');
insert into t2 (c) values('abc');
select * from t1,t2 where (a,b) = (c,d);
select host,user from mysql.user where (host,user) = ('localhost','test');
drop table t1,t2;

View File

@ -0,0 +1 @@
--replicate-do-table=test.t1 --replicate-do-table=test.t2 --replicate-do-table=test.t3 --replicate-ignore-table=test.t4 --replicate-ignore-table=test.t5 --replicate-ignore-table=test.t6

View File

@ -0,0 +1,206 @@
# Test evaluation of replication table filter rules
#
# ==== Purpose ====
#
# Test if replication table filter rules are properly evaluated when
# some of the tables referenced by the multiple-table update do not
# exist on slave.
#
# ==== Method ====
#
# Master creates tables t1, t2, t3, t4, t5, t6, t7, t8, t9 and the
# slave is started with the following replication table filter rules:
#
# --replicate-do-table=t1
# --replicate-do-table=t2
# --replicate-do-table=t3
#
# and
#
# --replicate-ignore-table=t4
# --replicate-ignore-table=t5
# --replicate-ignore-table=t6
#
# So the slave only replicate changes to tables t1, t2 and t3 and only
# these tables exist on slave.
#
# From now on, tables t1, t2, and t3 are referenced as do tables,
# tables t4, t5, t6 are referenced as ignore tables, and tables t7,
# t8, t9 are referenced as other tables.
#
# All multi-table update tests reference tables that are not do
# tables, which do not exist on slave. And the following situations
# of multi-table update will be tested:
#
# 1. Do tables are not referenced at all
# 2. Do tables are not referenced for update
# 3. Ignore tables are referenced for update before do tables
# 4. Only do tables are referenced for update
# 5. Do tables and other tables are referenced for update
# 6. Do tables are referenced for update before ignore tables
#
# For 1, 2 and 3, the statement should be ignored by slave, for 4, 5
# and 6 the statement should be accepted by slave and cause an error
# because of non-exist tables.
#
# ==== Related bugs ====
#
# BUG#37051 Replication rules not evaluated correctly
source include/master-slave.inc;
# These tables are mentioned in do-table rules
CREATE TABLE t1 (id int, a int);
CREATE TABLE t2 (id int, b int);
CREATE TABLE t3 (id int, c int);
# These tables are mentioned in ignore-table rules
CREATE TABLE t4 (id int, d int);
CREATE TABLE t5 (id int, e int);
CREATE TABLE t6 (id int, f int);
# These tables are not mentioned in do-table or ignore-table rules
CREATE TABLE t7 (id int, g int);
CREATE TABLE t8 (id int, h int);
CREATE TABLE t9 (id int, i int);
INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t2 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t3 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t4 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t5 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t6 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t7 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t8 VALUES (1, 1), (2, 2), (3, 3);
INSERT INTO t9 VALUES (1, 1), (2, 2), (3, 3);
# Only t1, t2, t3 should be replicated to slave
sync_slave_with_master;
echo [on slave];
SHOW TABLES LIKE 't%';
connection master;
echo [on master];
#
# Do tables are not referenced, these statements should be ignored by
# slave.
#
UPDATE t7 LEFT JOIN t4 ON (t4.id=t7.id) SET d=0, g=0 where t7.id=1;
UPDATE t7 LEFT JOIN (t4, t5, t6) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t6.id) SET d=0, e=0, f=0, g=0 where t7.id=1;
UPDATE t4 LEFT JOIN (t7, t8, t9) ON (t4.id=t7.id and t4.id=t8.id and t4.id=t9.id) SET d=0, g=0, h=0, i=0 where t4.id=1;
UPDATE t7 LEFT JOIN (t8, t9) ON (t7.id=t8.id and t7.id=t9.id) SET g=0, h=0, i=0 where t7.id=1;
#
# Do tables are not referenced for update, these statements should be
# ignored by slave.
#
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET d=0 where t1.id=1;
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET g=0 where t1.id=1;
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET d=0, e=0, f=0 where t1.id=1;
UPDATE t1 LEFT JOIN (t4, t5, t8) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t8.id) SET d=0, e=0, h=0 where t1.id=1;
UPDATE t1 LEFT JOIN (t7, t8, t5) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t5.id) SET g=0, h=0, e=0 where t1.id=1;
UPDATE t1 LEFT JOIN (t2, t3, t5) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t5.id) SET e=0 where t1.id=1;
#
# Ignore tables are referenced for update before do tables, these
# statements should be ignore by slave.
#
UPDATE t4 LEFT JOIN t1 ON (t1.id=t4.id) SET a=0, d=0 where t4.id=1;
UPDATE t4 LEFT JOIN (t1, t7) ON (t4.id=t1.id and t7.id=t4.id) SET a = 0, d=0, g=0 where t4.id=1;
UPDATE t4 LEFT JOIN (t1, t2, t3) ON (t1.id=t4.id and t2.id=t4.id and t3.id=t4.id) SET a=0, b=0, c=0, d=0 where t4.id=1;
UPDATE t4 LEFT JOIN (t1, t2, t5) ON (t1.id=t4.id and t2.id=t4.id and t5.id=t4.id) SET a=0, b=0, e=0, d=0 where t4.id=1;
UPDATE t4 LEFT JOIN (t1, t6, t7) ON (t4.id=t1.id and t4.id=t6.id and t4.id=t7.id) SET a=0, d=0, f=0, g=0 where t4.id=1;
UPDATE t7 LEFT JOIN (t4, t1, t2) ON (t7.id=t4.id and t7.id=t1.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
UPDATE t7 LEFT JOIN (t8, t4, t1) ON (t7.id=t8.id and t7.id=t4.id and t7.id=t1.id) SET a=0, d=0, g=0, h=0 where t7.id=1;
# Sync slave to make sure all above statements are correctly ignored,
# if any of the above statement are not ignored, it would cause error
# and stop slave sql thread.
sync_slave_with_master;
connection master;
# Parameters for include/wait_for_slave_sql_error_and_skip.inc:
# Ask it to show SQL error message.
let $show_sql_error= 1;
# The expected error will always be 1146 (ER_NO_SUCH_TABLE).
let $slave_sql_errno= 1146;
#
# Only do tables are referenced for update, these statements should
# cause error on slave
#
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t4, t7) ON (t1.id=t4.id and t1.id=t7.id) SET a=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t2, t4, t7) ON (t1.id=t2.id and t1.id=t4.id and t1.id=t7.id) SET a=0, b=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t2, t3, t7) ON (t1.id=t2.id and t1.id=t3.id and t1.id=t7.id) SET a=0, b=0, c=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
#
# Do tables and other tables are referenced for update, these
# statements should cause error on slave
#
UPDATE t1 LEFT JOIN t7 ON (t1.id=t7.id) SET a=0, g=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t7 LEFT JOIN t1 ON (t1.id=t7.id) SET a=0, g=0 where t7.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t4, t5, t7) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t7.id) SET a=0, g=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t4, t7, t8) ON (t1.id=t4.id and t1.id=t7.id and t1.id=t8.id) SET a=0, g=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t7, t8, t9) ON (t1.id=t7.id and t1.id=t8.id and t1.id=t9.id) SET a=0, g=0, h=0, i=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t7 LEFT JOIN (t1, t2, t3) ON (t7.id=t1.id and t7.id=t2.id and t7.id=t3.id) SET g=0, a=0, b=0, c=0 where t7.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t7 LEFT JOIN (t4, t5, t3) ON (t7.id=t4.id and t7.id=t5.id and t7.id=t3.id) SET g=0, c=0 where t7.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t7 LEFT JOIN (t8, t9, t3) ON (t7.id=t8.id and t7.id=t9.id and t7.id=t3.id) SET g=0, h=0, i=0, c=0 where t7.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
#
# Do tables are referenced for update before ignore tables
#
UPDATE t1 LEFT JOIN t4 ON (t1.id=t4.id) SET a=0, d=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t1 LEFT JOIN (t4, t5, t6) ON (t1.id=t4.id and t1.id=t5.id and t1.id=t6.id) SET a=0, d=0, e=0, f=0 where t1.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t4 LEFT JOIN (t1, t5, t6) ON (t4.id=t1.id and t4.id=t5.id and t4.id=t6.id) SET a=0, e=0, f=0 where t4.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
UPDATE t7 LEFT JOIN (t1, t4, t2) ON (t7.id=t1.id and t7.id=t4.id and t7.id=t2.id) SET a=0, b=0, d=0, g=0 where t7.id=1;
source include/wait_for_slave_sql_error_and_skip.inc;
sync_slave_with_master;
echo [on slave];
# We should only have tables t1, t2, t3 on slave
show tables like 't%';
# The rows in these tables should remain untouched
SELECT * FROM t1;
SELECT * FROM t2;
SELECT * FROM t3;
# Clean up
connection master;
echo [on master];
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
source include/master-slave-end.inc;

View File

@ -154,5 +154,31 @@ connection master;
DROP TABLE t1;
SET @@session.time_zone = default;
# Bug#41719 delayed INSERT into timestamp col needs set time_zone for concurrent binlogging
# To test that time_zone is correctly binloging for 'insert delayed' statement
# Insert 2 values into timestamp col with different time_zone. Check result.
--connection master
reset master;
CREATE TABLE t1 (date timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, a int(11) default NULL);
SET @@session.time_zone='+01:00';
insert into t1 values('2008-12-23 19:39:39',1);
--connection master1
SET @@session.time_zone='+02:00';
insert delayed into t1 values ('2008-12-23 19:39:39',2);
# Forces table t1 to be closed and flushes the query cache.
# This makes sure that 'delayed insert' is executed before next statement.
flush table t1;
flush logs;
select * from t1;
DROP TABLE t1;
--exec $MYSQL_BINLOG $MYSQLTEST_VARDIR/log/master-bin.000001 | $MYSQL
--connection master1
select * from t1 order by a;
DROP TABLE t1;
SET @@session.time_zone = default;
--echo End of 5.0 tests

View File

@ -293,7 +293,8 @@ STOP SLAVE;
connection master;
FLUSH LOGS;
exec cp $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001;
--remove_file $MYSQLTEST_VARDIR/log/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/bug16266.000001 $MYSQLTEST_VARDIR/log/master-bin.000001
# Make the slave to replay the new binlog.

View File

@ -1,6 +1,9 @@
# Uses GRANT commands that usually disabled in embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Test of some show commands
#
@ -33,7 +36,7 @@ check table t1 medium;
check table t1 extended;
show index from t1;
--disable_metadata
--error 1062
--error ER_DUP_ENTRY
insert into t1 values (5,5,5);
--echo -- Here we enable metadata just to check that the collation of the
@ -191,14 +194,14 @@ show columns from t1;
drop table t1;
#
# Test for Bug #2593 "SHOW CREATE TABLE doesn't properly double quotes"
# Test for Bug#2593 SHOW CREATE TABLE doesn't properly double quotes
#
SET @old_sql_mode= @@sql_mode, sql_mode= '';
SET @old_sql_quote_show_create= @@sql_quote_show_create, sql_quote_show_create= OFF;
######### hook for WL#1324 #
--error 1103
--error ER_WRONG_TABLE_NAME
CREATE TABLE `a/b` (i INT);
# the above test should WORK when WL#1324 is done,
# it should be removed and
@ -224,7 +227,7 @@ CREATE TABLE `a/b` (i INT);
#SHOW CREATE TABLE """a";
#DROP TABLE """a";
#
#Bug #4374 SHOW TABLE STATUS FROM ignores collation_connection
#Bug#4374 SHOW TABLE STATUS FROM ignores collation_connection
#set names latin1;
#create database `<60>`;
#create table `<60>`.`<60>` (a int) engine=heap;
@ -252,7 +255,7 @@ SET sql_quote_show_create= @old_sql_quote_show_create;
SET sql_mode= @old_sql_mode;
#
# Test for bug #2719 "Heap tables status shows wrong or missing data."
# Test for Bug#2719 Heap tables status shows wrong or missing data.
#
select @@max_heap_table_size;
@ -313,7 +316,7 @@ show table status;
drop table t1, t2, t3;
#
# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege
# Test for Bug#3342 SHOW CREATE DATABASE seems to require DROP privilege
#
create database mysqltest;
@ -328,36 +331,39 @@ connect (con1,localhost,mysqltest_1,,mysqltest);
connection con1;
select * from t1;
show create database mysqltest;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
drop table t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
disconnect con1;
connect (con2,localhost,mysqltest_2,,test);
connection con2;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
drop table mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
drop database mysqltest;
disconnect con2;
connect (con3,localhost,mysqltest_3,,test);
connection con3;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltest.t1;
--error 1044
--error ER_DBACCESS_DENIED_ERROR
show create database mysqltest;
drop table mysqltest.t1;
drop database mysqltest;
disconnect con3;
connection default;
set names binary;
delete from mysql.user
delete from mysql.user
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
@ -371,7 +377,7 @@ flush privileges;
#drop database `<60>`;
# Test that USING <keytype> is always shown in SHOW CREATE TABLE when it was
# specified during table creation, but not otherwise. (Bug #7235)
# specified during table creation, but not otherwise. (Bug#7235)
CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
@ -402,7 +408,7 @@ ALTER TABLE t1 ENGINE=MEMORY;
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test for BUG#9439 "Reporting wrong datatype for sub_part on show index"
# Test for Bug#9439 Reporting wrong datatype for sub_part on show index
CREATE TABLE t1(
field1 text NOT NULL,
PRIMARY KEY(field1(1000))
@ -412,7 +418,7 @@ show index from t1;
--disable_metadata
drop table t1;
# Test for BUG#11635: mysqldump exports TYPE instead of USING for HASH
# Test for Bug#11635 mysqldump exports TYPE instead of USING for HASH
create table t1 (
c1 int NOT NULL,
c2 int NOT NULL,
@ -422,7 +428,7 @@ create table t1 (
SHOW CREATE TABLE t1;
DROP TABLE t1;
# Test for BUG#93: 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
# Test for Bug#93 4.1 protocl crash on corupted frm and SHOW TABLE STATUS
flush tables;
@ -430,7 +436,7 @@ flush tables;
system echo "this is a junk file for test" >> $MYSQLTEST_VARDIR/master-data/test/t1.frm ;
--replace_column 6 # 7 # 8 # 9 #
SHOW TABLE STATUS like 't1';
--error 1033
--error ER_NOT_FORM_FILE
show create table t1;
drop table t1;
@ -438,7 +444,7 @@ drop table t1;
--echo End of 4.1 tests
#
# BUG 12183 - SHOW OPEN TABLES behavior doesn't match grammar
# Bug#12183 SHOW OPEN TABLES behavior doesn't match grammar
# First we close all open tables with FLUSH tables and then we open some.
CREATE TABLE txt1(a int);
CREATE TABLE tyt2(a int);
@ -456,14 +462,14 @@ DROP TABLE txt1;
DROP TABLE tyt2;
DROP TABLE urkunde;
#
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
# Bug#12591 SHOW TABLES FROM dbname produces wrong error message
#
--error 1049
--error ER_BAD_DB_ERROR
SHOW TABLES FROM non_existing_database;
#
# Bug#17203: "sql_no_cache sql_cache" in views created from prepared
# Bug#17203 "sql_no_cache sql_cache" in views created from prepared
# statement
#
# The problem was that initial user setting was forgotten, and current
@ -543,7 +549,7 @@ SHOW COLUMNS FROM no_such_table;
#
# Bug #19764: SHOW commands end up in the slow log as table scans
# Bug#19764 SHOW commands end up in the slow log as table scans
#
flush status;
show status like 'slow_queries';
@ -555,8 +561,8 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
# BUG#10491 Server returns data as charset binary SHOW CREATE TABLE or SELECT
# FROM I_S.
#
#
@ -671,7 +677,7 @@ SHOW TRIGGERS LIKE 't1';
--echo ----------------------------------------------------------------
SELECT
SELECT
TRIGGER_CATALOG,
TRIGGER_SCHEMA,
TRIGGER_NAME,
@ -794,10 +800,12 @@ CREATE TABLE t1(
# Check:
# - Dump mysqltest1;
--echo
--echo ---> Dumping mysqltest1 to show_check.mysqltest1.sql
--let $outfile1=$MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
--echo
--echo ---> Dumping mysqltest1 to outfile1
--exec $MYSQL_DUMP --default-character-set=latin1 --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $outfile1
# - Clean mysqltest1;
@ -812,7 +820,8 @@ DROP DATABASE mysqltest1;
--echo
--echo ---> Restoring mysqltest1...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/show_check.mysqltest1.sql
--exec $MYSQL test < $outfile1
--remove_file $outfile1
# - Check definition of the table.
@ -824,7 +833,7 @@ DROP DATABASE mysqltest1;
use test;
#
# Bug #28808: log_queries_not_using_indexes variable dynamic change is ignored
# Bug#28808 log_queries_not_using_indexes variable dynamic change is ignored
#
flush status;
show variables like "log_queries_not_using_indexes";
@ -840,7 +849,7 @@ select 1 from information_schema.tables limit 1;
show status like 'slow_queries';
#
# Bug #30088: Can't disable myisam-recover by a value of ""
# Bug#30088 Can't disable myisam-recover by a value of ""
#
show variables like 'myisam_recover_options';
@ -865,3 +874,7 @@ show create table t1;
drop table t1;
--echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,7 +1,10 @@
# Can't be tested with embedded server
-- source include/not_embedded.inc
--source include/not_embedded.inc
# Bug #8471: IP address with mask fail when skip-name-resolve is on
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Bug#8471 IP address with mask fail when skip-name-resolve is on
GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
@ -9,12 +12,17 @@ DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
# End of 4.1 tests
# Bug #13407 "Remote connecting crashes server".
# Bug#13407 Remote connecting crashes server
# Server crashed when one used USER() function in connection for which
# was impossible to obtain peer hostname.
connect (con1, 127.0.0.1, root, , test, $MASTER_MYPORT, );
--replace_column 1 #
select user();
SELECT USER();
--replace_column 1 <id> 3 <host> 5 <command> 6 <time> 7 <state> 8 <info>
show processlist;
SHOW PROCESSLIST;
connection default;
disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,);
connection con1root;
@ -156,7 +159,7 @@ call db1_secret.stamp(6);
select db1_secret.db();
#
# BUG#2777
# Bug#2777 Stored procedure doesn't observe definer's rights
#
connection con1root;
@ -215,7 +218,7 @@ call q();
select * from t2;
#
# BUG#6030: Stored procedure has no appropriate DROP privilege
# Bug#6030 Stored procedure has no appropriate DROP privilege
# (or ALTER for that matter)
# still connection con2user1 in db2
@ -330,7 +333,7 @@ flush privileges;
drop table t1;
#
# BUG#9503: reseting correct parameters of thread after error in SP function
# Bug#9503 reseting correct parameters of thread after error in SP function
#
connect (root,localhost,root,,test);
connection root;
@ -366,10 +369,12 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503;
use test;
drop database mysqltest;
connection default;
disconnect root;
#
# correct value from current_user() in function run from "security definer"
# (BUG#7291)
# (Bug#7291 Stored procedures: wrong CURRENT_USER value)
#
connection con1root;
use test;
@ -398,10 +403,10 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop user user1@localhost;
#
# Bug #12318: Wrong error message when accessing an inaccessible stored
# Bug#12318 Wrong error message when accessing an inaccessible stored
# procedure in another database when the current database is
# information_schema.
#
#
--disable_warnings
drop database if exists mysqltest_1;
@ -438,7 +443,7 @@ revoke usage on *.* from mysqltest_1@localhost;
drop user mysqltest_1@localhost;
#
# BUG#12812 create view calling a function works without execute right
# Bug#12812 create view calling a function works without execute right
# on function
delimiter |;
--disable_warnings
@ -464,7 +469,7 @@ delimiter ;|
#
# BUG#14834: Server denies to execute Stored Procedure
# Bug#14834 Server denies to execute Stored Procedure
#
# The problem here was with '_' in the database name.
#
@ -507,7 +512,7 @@ drop database db_bug14834;
#
# BUG#14533: 'desc tbl' in stored procedure causes error
# Bug#14533 'desc tbl' in stored procedure causes error
# ER_TABLEACCESS_DENIED_ERROR
#
create database db_bug14533;
@ -546,20 +551,20 @@ drop database db_bug14533;
#
# BUG#7787: Stored procedures: improper warning for "grant execute" statement
# Bug#7787 Stored procedures: improper warning for "grant execute" statement
#
# Prepare.
CREATE DATABASE db_bug7787;
use db_bug7787;
USE db_bug7787;
# Test.
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
SHOW INNODB STATUS;
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
# Cleanup.
@ -569,7 +574,7 @@ use test;
#
# WL#2897: Complete definer support in the stored routines.
# WL#2897 Complete definer support in the stored routines.
#
# The following cases are tested:
# 1. check that if DEFINER-clause is not explicitly specified, stored routines
@ -614,7 +619,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE wl2897_p1() SELECT 1;
@ -626,7 +631,7 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
use mysqltest;
USE mysqltest;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;
@ -652,7 +657,7 @@ CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
--echo ---> connection: con1root
--connection con1root
use mysqltest;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
SHOW CREATE PROCEDURE wl2897_p3;
@ -672,7 +677,7 @@ DROP DATABASE mysqltest;
#
# BUG#13198: SP executes if definer does not exist
# Bug#13198 SP executes if definer does not exist
#
# Prepare environment.
@ -702,7 +707,7 @@ GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;
--echo ---> connection: mysqltest_1_con
--connection mysqltest_1_con
use mysqltest;
USE mysqltest;
CREATE PROCEDURE bug13198_p1()
SELECT 1;
@ -720,7 +725,7 @@ SELECT bug13198_f1();
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
CALL bug13198_p1();
@ -742,7 +747,7 @@ DROP USER mysqltest_1@localhost;
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use mysqltest;
USE mysqltest;
--error ER_NO_SUCH_USER
CALL bug13198_p1();
@ -764,8 +769,8 @@ DROP DATABASE mysqltest;
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
# Bug#19857 When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
#
# Can't test with embedded server that doesn't support grants
@ -780,7 +785,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
--echo ---> connection: mysqltest_2_con
--connection mysqltest_2_con
use test;
USE test;
DELIMITER //;
CREATE PROCEDURE sp19857() DETERMINISTIC
@ -814,8 +819,7 @@ DROP USER user19857@localhost;
#
# BUG#18630: Arguments of suid routine calculated in wrong security
# context
# Bug#18630 Arguments of suid routine calculated in wrong security context
#
# Arguments of suid routines were calculated in definer's security
# context instead of caller's context thus creating security hole.
@ -886,3 +890,7 @@ DROP FUNCTION f_suid;
DROP TABLE t1;
--echo End of 5.0 tests.
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -5,6 +5,9 @@
# except security/privilege tests, they go to sp-security.test
#
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (con1root,localhost,root,,);
connect (con2root,localhost,root,,);
connect (con3root,localhost,root,,);
@ -17,7 +20,7 @@ drop table if exists t1;
--enable_warnings
create table t1 (s1 int, s2 int, s3 int);
delimiter //;
delimiter //;
create procedure bug4934()
begin
insert into t1 values (1,0,1);
@ -38,7 +41,7 @@ drop table t1;
create table t1 (s1 int, s2 int, s3 int);
drop procedure bug4934;
delimiter //;
delimiter //;
create procedure bug4934()
begin
end//
@ -58,7 +61,7 @@ drop procedure bug4934;
#
# BUG #9486 "Can't perform multi-update in stored procedure"
# Bug#9486 Can't perform multi-update in stored procedure
#
--disable_warnings
drop procedure if exists bug9486;
@ -87,8 +90,9 @@ reap;
drop procedure bug9486;
drop table t1, t2;
#
# BUG#11158: Can't perform multi-delete in stored procedure
# Bug#11158 Can't perform multi-delete in stored procedure
#
--disable_warnings
drop procedure if exists bug11158;
@ -114,8 +118,9 @@ connection con1root;
drop procedure bug11158;
drop table t1, t2;
#
# BUG#11554: Server crashes on statement indirectly using non-cached function
# Bug#11554 Server crashes on statement indirectly using non-cached function
#
--disable_warnings
drop function if exists bug11554;
@ -134,7 +139,7 @@ drop table t1;
drop view v1;
# BUG#12228
# Bug#12228 Crash happens during calling specific SP in multithread environment
--disable_warnings
drop procedure if exists p1;
drop procedure if exists p2;
@ -168,18 +173,26 @@ connection con2root;
unlock tables;
connection con1root;
# Crash will be here if we hit BUG#12228
# Crash will be here if we hit Bug#12228
reap;
drop procedure p1;
drop procedure p2;
drop table t1;
#
# BUG#NNNN: New bug synopsis
# Bug#NNNN New bug synopsis
#
#--disable_warnings
#drop procedure if exists bugNNNN;
#--enable_warnings
#create procedure bugNNNN...
connection default;
disconnect con1root;
disconnect con2root;
disconnect con3root;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1,14 +1,17 @@
# Can't test with embedded server
-- source include/not_embedded.inc
--sleep 2
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1,t3;
--enable_warnings
delimiter |;
#
# BUG#4902: Stored procedure with SHOW WARNINGS leads to packet error
# Bug#4902: Stored procedure with SHOW WARNINGS leads to packet error
#
# Added tests for show grants command
--disable_warnings
@ -47,7 +50,7 @@ drop procedure bug4902_2|
#
# BUG#5278: Stored procedure packets out of order if SET PASSWORD.
# Bug#5278: Stored procedure packets out of order if SET PASSWORD.
#
--disable_warnings
drop function if exists bug5278|
@ -58,13 +61,16 @@ begin
return 'okay';
end|
--error 1133
--error ER_PASSWORD_NO_MATCH
select bug5278()|
--error 1133
--error ER_PASSWORD_NO_MATCH
select bug5278()|
drop function bug5278|
#
# Bug#3583: query cache doesn't work for stored procedures
#
--disable_warnings
drop table if exists t1|
--enable_warnings
@ -72,9 +78,6 @@ create table t1 (
id char(16) not null default '',
data int not null
)|
#
# BUG#3583: query cache doesn't work for stored procedures
#
--disable_warnings
drop procedure if exists bug3583|
--enable_warnings
@ -110,8 +113,9 @@ delete from t1|
drop procedure bug3583|
drop table t1|
#
# BUG#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
# Bug#6807: Stored procedure crash if CREATE PROCEDURE ... KILL QUERY
#
--disable_warnings
drop procedure if exists bug6807|
@ -125,16 +129,16 @@ begin
select 'Not reached';
end|
--error 1317
--error ER_QUERY_INTERRUPTED
call bug6807()|
--error 1317
--error ER_QUERY_INTERRUPTED
call bug6807()|
drop procedure bug6807|
#
# BUG#10100: function (and stored procedure?) recursivity problem
# Bug#10100: function (and stored procedure?) recursivity problem
#
--disable_warnings
drop function if exists bug10100f|
@ -233,11 +237,11 @@ begin
close c;
end|
#end of the stack checking
# end of the stack checking
set @@max_sp_recursion_depth=255|
set @var=1|
#disable log because error about stack overrun contains numbers which
#depend on a system
# disable log because error about stack overrun contains numbers which
# depend on a system
-- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)|
@ -266,6 +270,7 @@ drop table t3|
delimiter ;|
#
# Bug#15298 SHOW GRANTS FOR CURRENT_USER: Incorrect output in DEFINER context
#
@ -282,6 +287,11 @@ call 15298_1();
call 15298_2();
connection default;
disconnect con1;
drop user mysqltest_1@localhost;
drop procedure 15298_1;
drop procedure 15298_2;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,12 +4,15 @@
-- source include/have_ssl.inc
-- source include/big_test.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings
#
# Bug #29579 Clients using SSL can hang the server
# Bug#29579 Clients using SSL can hang the server
#
connect (ssl_con,localhost,root,,,,,SSL);
@ -18,7 +21,7 @@ create table t1 (a int);
disconnect ssl_con;
--disable_query_log
--disable_result_log
@ -26,31 +29,36 @@ let $count= 2000;
while ($count)
{
connect (ssl_con,localhost,root,,,,,SSL);
eval insert into t1 values ($count);
dec $count;
# This select causes the net buffer to fill as the server sends the results
# This select causes the net buffer to fill as the server sends the results
# but the client doesn't reap the results. The results are larger each time
# through the loop, so that eventually the buffer is completely full
# at the exact moment the server attempts to the close the connection with
# the lock held.
send select * from t1;
# now send the quit the command so the server will initiate the shutdown.
send_quit ssl_con;
send_quit ssl_con;
# if the server is hung, this will hang too:
connect (ssl_con2,localhost,root,,,,,SSL);
# no hang if we get here, close and retry
disconnect ssl_con2;
disconnect ssl_con;
}
}
--enable_query_log
--enable_result_log
connect (ssl_con,localhost,root,,,,,SSL);
drop table t1;
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -3,6 +3,9 @@
-- source include/have_ssl.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
@ -14,4 +17,9 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
connection default;
disconnect ssl_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -4,6 +4,9 @@
-- source include/have_ssl.inc
-- source include/have_compress.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
@ -20,3 +23,10 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
connection default;
disconnect ssl_compress_con;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -1,6 +1,9 @@
# embedded server causes different stat
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# PS causes different statistics
--disable_ps_protocol
@ -208,3 +211,7 @@ DROP PROCEDURE p1;
DROP FUNCTION f1;
# End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

File diff suppressed because it is too large Load Diff

View File

@ -640,4 +640,33 @@ WHERE NULL NOT IN (
DROP TABLE t1;
#
# Bug #39069: <row constructor> IN <table-subquery> seriously messed up
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (11);
--echo # 2nd and 3rd columns should be same
SELECT a, ROW(11, 12) = (SELECT a, 22), ROW(11, 12) IN (SELECT a, 22) FROM t1 GROUP BY t1.a;
SELECT a, ROW(11, 12) = (SELECT a, 12), ROW(11, 12) IN (SELECT a, 12) FROM t1 GROUP BY t1.a;
SELECT a, ROW(11, 12) = (SELECT a, 22), ROW(11, 12) IN (SELECT a, 22) FROM t1;
SELECT a, ROW(11, 12) = (SELECT a, 12), ROW(11, 12) IN (SELECT a, 12) FROM t1;
# The x alias is used below to workaround bug #40674.
# Regression tests for sum function on outer column in subselect from dual:
SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 22), ROW(11, 12) IN (SELECT MAX(x), 22) FROM t1;
--echo # 2nd and 3rd columns should be same for x == 11 only
SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), 12) FROM t1;
DROP TABLE t1;
--echo # both columns should be same
SELECT ROW(1,2) = (SELECT NULL, NULL), ROW(1,2) IN (SELECT NULL, NULL);
SELECT ROW(1,2) = (SELECT 1, NULL), ROW(1,2) IN (SELECT 1, NULL);
SELECT ROW(1,2) = (SELECT NULL, 2), ROW(1,2) IN (SELECT NULL, 2);
SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1);
SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1);
SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2);
--echo End of 5.0 tests

View File

@ -1,10 +1,13 @@
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
#
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination
# table
# Test for Bug#2385 CREATE TABLE LIKE lacks locking on source and destination
# table
#
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1,t2;
--enable_warnings
connect (con1,localhost,root,,);
@ -12,12 +15,12 @@ connect (con2,localhost,root,,);
# locking of source:
CREATE TABLE t1 (x1 int);
CREATE TABLE t1 (x1 INT);
let $1= 10;
while ($1)
{
connection con1;
send ALTER TABLE t1 CHANGE x1 x2 int;
send ALTER TABLE t1 CHANGE x1 x2 INT;
connection con2;
CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
@ -25,7 +28,7 @@ while ($1)
DROP TABLE t2;
connection con1;
reap;
send ALTER TABLE t1 CHANGE x2 x1 int;
send ALTER TABLE t1 CHANGE x2 x1 INT;
connection con2;
CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
@ -37,4 +40,11 @@ while ($1)
}
DROP TABLE t1;
connection default;
disconnect con1;
disconnect con2;
# End of 4.1 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -1,15 +1,18 @@
# Embedded server testing does not support grants
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop tables if exists t1, t2;
drop view if exists v1;
--enable_warnings
#
# Test for bug #6116 "SET time_zone := ... requires access to mysql.time_zone
# tables". We should allow implicit access to time zone description tables
# even for unprivileged users.
# Test for Bug#6116 SET time_zone := ... requires access to mysql.time_zone tables
# We should allow implicit access to time zone description tables even for
# unprivileged users.
#
# Let us prepare playground
@ -33,18 +36,20 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
# But still these two statements should not work:
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysql.time_zone_name;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
connection default;
disconnect tzuser;
#
# Test for bug #6765 "Implicit access to time zone description tables
# requires privileges for them if some table or column level grants
# present"
# Bug#6765 Implicit access to time zone description tables requires privileges
# for them if some table or column level grants present
#
connection default;
# Let use some table-level grants instead of db-level
# Let use some table-level grants instead of db-level
# to make life more interesting
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
@ -61,14 +66,14 @@ select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
where t1.a = t2.c and t2.d = (select max(d) from t2);
# Again these two statements should not work (but with different errors):
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select * from mysql.time_zone_name;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
#
# Bug #9979: Use of CONVERT_TZ in multiple-table UPDATE causes bogus
# privilege error
# Bug#9979 Use of CONVERT_TZ in multiple-table UPDATE causes bogus
# privilege error
#
drop table t1, t2;
create table t1 (a int, b datetime);
@ -80,6 +85,7 @@ update t1 join t2 on (t1.a = t2.a) set t1.b = convert_tz('2005-01-01 10:00','UTC
# Clean-up
connection default;
disconnect tzuser2;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
@ -89,10 +95,9 @@ drop table t1, t2;
# End of 4.1 tests
#
# Additional test for bug #15153: CONVERT_TZ() is not allowed in all
# places in views.
# Additional test for Bug#15153 CONVERT_TZ() is not allowed in all places in views.
#
# Let us check that usage of CONVERT_TZ() function in view does not
# Let us check that usage of CONVERT_TZ() function in view does not
# require additional privileges.
# Let us rely on that previous tests done proper cleanups
@ -109,7 +114,11 @@ drop view v1;
--error ER_TABLEACCESS_DENIED_ERROR
create view v1 as select a, convert_tz(b, 'UTC', 'Europe/Moscow') as lb from t1, mysql.time_zone;
connection default;
disconnect tzuser3;
drop table t1;
drop user mysqltest_1@localhost;
# End of 5.0 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -50,9 +50,7 @@ GRANT CREATE ON mysqltest_db1.* TO mysqltest_dfn@localhost;
CREATE TABLE t1(num_value INT);
CREATE TABLE t2(user_str TEXT);
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
FOR EACH ROW
INSERT INTO t2 VALUES(CURRENT_USER());
CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES(CURRENT_USER());
#
# Remove definers from TRG file.
@ -61,8 +59,24 @@ CREATE TRIGGER wl2818_trg1 BEFORE INSERT ON t1
--echo
--echo ---> patching t1.TRG...
--exec grep -v 'definers=' $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG
--exec mv $MYSQLTEST_VARDIR/tmp/t1.TRG $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
# Here we remove definers. This is somewhat complex than the original test
# Previously, the test only used grep -v 'definers=' t1.TRG, but grep is not
# portable and we have to load the file into a table, exclude the definers line,
# then load the data to an outfile to accomplish the same effect
--disable_query_log
--connection default
CREATE TABLE patch (a blob);
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG' INTO TABLE patch;
# remove original t1.TRG file so SELECT INTO OUTFILE won't fail
--remove_file $MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG
eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE
'$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG'
FROM patch;
DROP TABLE patch;
--connection wl2818_definer_con
--enable_query_log
#
# Create a new trigger.

View File

@ -40,7 +40,9 @@ drop table t1;
create table t1 (a bit) engine=innodb;
insert into t1 values (b'0'), (b'1'), (b'000'), (b'100'), (b'001');
select hex(a) from t1;
--error 1062
# It is not deterministic which duplicate will be seen first
--replace_regex /(.*Duplicate entry )'.*'( for key.*)/\1''\2/
--error ER_DUP_ENTRY
alter table t1 add unique (a);
drop table t1;

View File

@ -267,4 +267,13 @@ select u from t1;
drop table t1;
#
# Bug #21205: Different number of digits for float/doble/real in --ps-protocol
#
CREATE TABLE t1 (f1 DOUBLE);
INSERT INTO t1 VALUES(-1.79769313486231e+308);
SELECT f1 FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -324,7 +324,7 @@ insert into t1 (a, c) values (4, '2004-04-04 00:00:00'),
select * from t1;
drop table t1;
# End of 4.1 tests
--echo End of 4.1 tests
# Restore timezone to default
set time_zone= @@global.time_zone;
@ -339,3 +339,21 @@ PRIMARY KEY (`id`)
show fields from t1;
select is_nullable from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='t1' and COLUMN_NAME='posted_on';
drop table t1;
#
# Bug#41370: TIMESTAMP field does not accepts NULL from FROM_UNIXTIME()
#
CREATE TABLE t1 ( f1 INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
f2 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
f3 TIMESTAMP);
INSERT INTO t1 (f2,f3) VALUES (NOW(), "0000-00-00 00:00:00");
INSERT INTO t1 (f2,f3) VALUES (NOW(), NULL);
INSERT INTO t1 (f2,f3) VALUES (NOW(), ASCII(NULL));
INSERT INTO t1 (f2,f3) VALUES (NOW(), FROM_UNIXTIME('9999999999'));
INSERT INTO t1 (f2,f3) VALUES (NOW(), TIME(NULL));
UPDATE t1 SET f2=NOW(), f3=FROM_UNIXTIME('9999999999') WHERE f1=1;
SELECT f1,f2-f3 FROM t1;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -933,17 +933,25 @@ SELECT a INTO @v FROM (
SELECT a FROM t1
) alias;
SELECT a INTO OUTFILE 'union.out.file' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
--let $outfile = $MYSQLTEST_VARDIR/tmp/union.out.file
--error 0,1
--remove_file $outfile
SELECT a INTO DUMPFILE 'union.out.file2' FROM (
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a INTO OUTFILE '$outfile' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
--remove_file $outfile
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a INTO DUMPFILE '$outfile' FROM (
SELECT a FROM t1
UNION
SELECT a FROM t1 WHERE 0
) alias;
--remove_file $outfile
#
# INTO will not be allowed in subqueries in version 5.1 and above.
@ -954,27 +962,42 @@ SELECT a FROM (
SELECT a INTO @v FROM t1
) alias;
SELECT a FROM (
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM (
SELECT a FROM t1
UNION
SELECT a INTO OUTFILE 'union.out.file3' FROM t1
SELECT a INTO OUTFILE '$outfile' FROM t1
) alias;
--remove_file $outfile
SELECT a FROM (
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM (
SELECT a FROM t1
UNION
SELECT a INTO DUMPFILE 'union.out.file4' FROM t1
SELECT a INTO DUMPFILE '$outfile' FROM t1
) alias;
--remove_file $outfile
SELECT a FROM t1 UNION SELECT a INTO @v FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file5' FROM t1;
SELECT a FROM t1 UNION SELECT a INTO OUTFILE 'union.out.file6' FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM t1 UNION SELECT a INTO OUTFILE '$outfile' FROM t1;
--remove_file $outfile
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
eval SELECT a FROM t1 UNION SELECT a INTO DUMPFILE '$outfile' FROM t1;
--remove_file $outfile
--error ER_WRONG_USAGE
SELECT a INTO @v FROM t1 UNION SELECT a FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE
SELECT a INTO OUTFILE 'union.out.file7' FROM t1 UNION SELECT a FROM t1;
eval SELECT a INTO OUTFILE '$outfile' FROM t1 UNION SELECT a FROM t1;
--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
--error ER_WRONG_USAGE
SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1;
eval SELECT a INTO DUMPFILE '$outfile' FROM t1 UNION SELECT a FROM t1;
DROP TABLE t1;

View File

@ -3,9 +3,12 @@
#
# Requires privileges to be enabled
-- source include/not_embedded.inc
--source include/not_embedded.inc
# Prepare play-ground
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# Prepare play-ground
--disable_warnings
drop table if exists t1;
--enable_warnings
@ -28,11 +31,11 @@ connect (mqph, localhost, mysqltest_1,,);
connection mqph;
select * from t1;
select * from t1;
--error 1226
--error ER_USER_LIMIT_REACHED
select * from t1;
connect (mqph2, localhost, mysqltest_1,,);
connection mqph2;
--error 1226
--error ER_USER_LIMIT_REACHED
select * from t1;
# cleanup
connection default;
@ -50,12 +53,12 @@ select * from t1;
select * from t1;
delete from t1;
delete from t1;
--error 1226
--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
connect (muph2, localhost, mysqltest_1,,);
connection muph2;
--error 1226
--error ER_USER_LIMIT_REACHED
delete from t1;
select * from t1;
# Cleanup
@ -74,7 +77,7 @@ connect (mcph2, localhost, mysqltest_1,,);
connection mcph2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Old connection is still ok
select * from t1;
@ -83,7 +86,7 @@ select * from t1;
disconnect mcph1;
disconnect mcph2;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (mcph3, localhost, mysqltest_1,,);
# Cleanup
connection default;
@ -101,13 +104,13 @@ connect (muc2, localhost, mysqltest_1,,);
connection muc2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muc3, localhost, mysqltest_1,,);
# Closing of one of connections should help
disconnect muc1;
connect (muc3, localhost, mysqltest_1,,);
select * from t1;
# Changing of limit should also help (and immediately)
# Changing of limit should also help (and immediately)
connection default;
grant usage on *.* to mysqltest_1@localhost with max_user_connections 3;
flush user_resources;
@ -115,7 +118,7 @@ connect (muc4, localhost, mysqltest_1,,);
connection muc4;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muc5, localhost, mysqltest_1,,);
# Clean up
connection default;
@ -129,10 +132,10 @@ drop user mysqltest_1@localhost;
select @@session.max_user_connections, @@global.max_user_connections;
# Local max_user_connections variable can't be set directly
# since this limit is per-account
--error 1229
set session max_user_connections= 2;
--error ER_GLOBAL_VARIABLE
set session max_user_connections= 2;
# But it is ok to set global max_user_connections
set global max_user_connections= 2;
set global max_user_connections= 2;
select @@session.max_user_connections, @@global.max_user_connections;
# Let us check that global limit works
grant usage on *.* to mysqltest_1@localhost;
@ -144,7 +147,7 @@ connect (muca2, localhost, mysqltest_1,,);
connection muca2;
select * from t1;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1203
--error ER_TOO_MANY_USER_CONNECTIONS
connect (muca3, localhost, mysqltest_1,,);
# Now we are testing that per-account limit prevails over gloabl limit
connection default;
@ -154,16 +157,20 @@ connect (muca3, localhost, mysqltest_1,,);
connection muca3;
select @@session.max_user_connections, @@global.max_user_connections;
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
--error 1226
--error ER_USER_LIMIT_REACHED
connect (muca4, localhost, mysqltest_1,,);
# Cleanup
connection default;
disconnect muca1;
disconnect muca2;
disconnect muca3;
set global max_user_connections= 0;
set global max_user_connections= 0;
drop user mysqltest_1@localhost;
--enable_ps_protocol
# Final cleanup
drop table t1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc

View File

@ -6,7 +6,7 @@ drop table if exists t1,t2;
--enable_warnings
#
# Bug #19263: variables.test doesn't clean up after itself (I/II -- save)
# Bug#19263: variables.test doesn't clean up after itself (I/II -- save)
#
set @my_binlog_cache_size =@@global.binlog_cache_size;
set @my_connect_timeout =@@global.connect_timeout;
@ -150,18 +150,46 @@ select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select ROUND(RAND(),5);
show variables like '%alloc%';
set @@range_alloc_block_size=1024*16;
--echo
--echo ==+ Testing %alloc% system variables +==
--echo ==+ NOTE: These values *must* be a multiple of 1024 +==
--echo ==+ Other values will be rounded down to nearest multiple +==
--echo
--echo ==+ Show initial values +==
SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
'query_alloc_block_size', 'query_prealloc_size',
'transaction_alloc_block_size', 'transaction_prealloc_size');
--echo ==+ Manipulate variable values +=
--echo Testing values that are multiples of 1024
set @@range_alloc_block_size=1024*15+1024;
set @@query_alloc_block_size=1024*15+1024*2;
set @@query_prealloc_size=1024*18-1024;
set @@transaction_alloc_block_size=1024*21-1024*1;
set @@transaction_prealloc_size=1024*21-2048;
--echo ==+ Check manipulated values ==+
SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
'query_alloc_block_size', 'query_prealloc_size',
'transaction_alloc_block_size', 'transaction_prealloc_size');
--echo ==+ Manipulate variable values +==
--echo Testing values that are not 1024 multiples
set @@range_alloc_block_size=1024*16+1023;
set @@query_alloc_block_size=1024*17+2;
set @@query_prealloc_size=1024*18;
set @@query_prealloc_size=1024*18-1023;
set @@transaction_alloc_block_size=1024*20-1;
set @@transaction_prealloc_size=1024*21-1;
select @@query_alloc_block_size;
show variables like '%alloc%';
--echo ==+ Check manipulated values ==+
SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
'query_alloc_block_size', 'query_prealloc_size',
'transaction_alloc_block_size', 'transaction_prealloc_size');
--echo ==+ Set values back to the default values +==
set @@range_alloc_block_size=default;
set @@query_alloc_block_size=default, @@query_prealloc_size=default;
set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
show variables like '%alloc%';
--echo ==+ Check the values now that they are reset +==
SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size',
'query_alloc_block_size', 'query_prealloc_size',
'transaction_alloc_block_size', 'transaction_prealloc_size');
#
# Bug #10904 Illegal mix of collations between
@ -172,46 +200,46 @@ SELECT @@version_compile_os LIKE 'non-existent';
# The following should give errors
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set big_tables=OFFF;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set big_tables="OFFF";
--error 1193
--error ER_UNKNOWN_SYSTEM_VARIABLE
set unknown_variable=1;
--error 1232
--error ER_WRONG_TYPE_FOR_VAR
set max_join_size="hello";
--error 1286
--error ER_UNKNOWN_STORAGE_ENGINE
set storage_engine=UNKNOWN_TABLE_TYPE;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set storage_engine=MERGE, big_tables=2;
show local variables like 'storage_engine';
--error 1229
--error ER_GLOBAL_VARIABLE
set SESSION query_cache_size=10000;
--error 1230
--error ER_NO_DEFAULT
set GLOBAL storage_engine=DEFAULT;
--error 1115
--error ER_UNKNOWN_CHARACTER_SET
set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1273
--error ER_UNKNOWN_COLLATION
set collation_connection=UNKNOWN_COLLATION;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set character_set_client=NULL;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set collation_connection=NULL;
--error 1228
--error ER_LOCAL_VARIABLE
set global autocommit=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.timestamp;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@version='';
--error 1229
--error ER_GLOBAL_VARIABLE
set @@concurrent_insert=1;
--error 1228
--error ER_LOCAL_VARIABLE
set @@global.sql_auto_is_null=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@global.sql_auto_is_null;
--error 1229
--error ER_GLOBAL_VARIABLE
set myisam_max_sort_file_size=100;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set @@SQL_WARNINGS=NULL;
# Test setting all variables
@ -338,23 +366,23 @@ drop table t1,t2;
# error conditions
#
--error 1193
--error ER_UNKNOWN_SYSTEM_VARIABLE
select @@xxxxxxxxxx;
select 1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.key_buffer_size;
--error 1229
--error ER_GLOBAL_VARIABLE
set ft_boolean_syntax = @@init_connect;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global ft_boolean_syntax = @@init_connect;
--error 1229
--error ER_GLOBAL_VARIABLE
set init_connect = NULL;
set global init_connect = NULL;
--error 1229
--error ER_GLOBAL_VARIABLE
set ft_boolean_syntax = @@init_connect;
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global ft_boolean_syntax = @@init_connect;
# Bug#3754 SET GLOBAL myisam_max_sort_file_size doesn't work as
@ -385,15 +413,15 @@ select @a, @b;
#
# Bug#2586:Disallow global/session/local as structured var. instance names
#
--error 1064
--error ER_PARSE_ERROR
set @@global.global.key_buffer_size= 1;
--error 1064
--error ER_PARSE_ERROR
set GLOBAL global.key_buffer_size= 1;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.global.key_buffer_size;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.session.key_buffer_size;
--error 1064
--error ER_PARSE_ERROR
SELECT @@global.local.key_buffer_size;
# BUG#5135: cannot turn on log_warnings with SET in 4.1 (and 4.0)
@ -478,27 +506,27 @@ select @@lc_time_names;
--echo *** LC_TIME_NAMES: testing with string expressions
set lc_time_names=concat('de','_','DE');
select @@lc_time_names;
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=concat('de','+','DE');
select @@lc_time_names;
--echo LC_TIME_NAMES: testing with numeric expressions
set @@lc_time_names=1+2;
select @@lc_time_names;
--error 1232
--error ER_WRONG_TYPE_FOR_VAR
set @@lc_time_names=1/0;
select @@lc_time_names;
set lc_time_names=en_US;
--echo LC_TIME_NAMES: testing NULL and a negative number:
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set lc_time_names=NULL;
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=-1;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing locale with the last ID:
set lc_time_names=108;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing a number beyond the valid ID range:
--error 1105
--error ER_UNKNOWN_ERROR
set lc_time_names=109;
select @@lc_time_names;
--echo LC_TIME_NAMES: testing that 0 is en_US:
@ -540,7 +568,7 @@ select @@query_prealloc_size = @test;
# Bug#31588 buffer overrun when setting variables
#
# Buffer-size Off By One. Should throw valgrind-warning without fix #31588.
--error 1231
--error ER_WRONG_VALUE_FOR_VAR
set global sql_mode=repeat('a',80);
--echo End of 4.1 tests
@ -558,9 +586,9 @@ drop table t1;
# Bug #10339: read only variables.
#
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@warning_count=1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@global.error_count=1;
#
@ -578,9 +606,9 @@ select @@max_heap_table_size > 0;
# Bug #11775 Variable character_set_system does not exist (sometimes)
#
select @@character_set_system;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set global character_set_system = latin1;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@global.version_compile_os='234';
#
@ -677,7 +705,7 @@ select @@@;
# Don't actually output, since it depends on the system
--replace_column 1 #
select @@hostname;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
set @@hostname= "anothername";
--replace_column 2 #
show variables like 'hostname';
@ -688,12 +716,12 @@ show variables like 'hostname';
SHOW VARIABLES LIKE 'log';
SELECT @@log;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET GLOBAL log=0;
SHOW VARIABLES LIKE 'log_slow_queries';
SELECT @@log_slow_queries;
--error 1238
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET GLOBAL log_slow_queries=0;
--echo End of 5.0 tests

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,9 @@
# Can't test with embedded server
-- source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
# simple test of grants
grant create view on test.* to test@localhost;
show grants for test@localhost;
@ -26,19 +29,19 @@ grant create view,select on test.* to mysqltest_1@localhost;
connect (user1,localhost,mysqltest_1,,test);
connection user1;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
create definer=root@localhost view v1 as select * from mysqltest.t1;
create view v1 as select * from mysqltest.t1;
# try to modify view without DROP privilege on it
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
alter view v1 as select * from mysqltest.t1;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create or replace view v1 as select * from mysqltest.t1;
# no CRETE VIEW privilege
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v2 as select * from mysqltest.t1;
# no SELECT privilege
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create view v2 as select * from mysqltest.t2;
connection root;
@ -48,7 +51,7 @@ show create view v1;
grant create view,drop,select on test.* to mysqltest_1@localhost;
connection user1;
# following 'use' command is workaround of bug #9582 and should be removed
# following 'use' command is workaround of Bug#9582 and should be removed
# when that bug will be fixed
use test;
alter view v1 as select * from mysqltest.t1;
@ -76,7 +79,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
select c from mysqltest.v1;
# there are no privileges on column 'd'
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1;
connection root;
@ -96,7 +99,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
select c from mysqltest.v1;
# there are no privileges on column 'd'
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
select d from mysqltest.v1;
connection root;
@ -111,7 +114,7 @@ connection root;
--disable_warnings
create database mysqltest;
--enable_warnings
#prepare views and tables
# prepare views and tables
create table mysqltest.t1 (a int, b int);
create table mysqltest.t2 (a int, b int);
create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
@ -133,21 +136,21 @@ select c from mysqltest.v4;
show columns from mysqltest.v1;
show columns from mysqltest.v2;
# but explain/show do not
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v1;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v2;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4;
# allow to see one of underlying table
@ -156,19 +159,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
connection user1;
# EXPLAIN of view on above table works
explain select c from mysqltest.v1;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v1;
explain select c from mysqltest.v2;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v2;
# but other EXPLAINs do not
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v3;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v3;
-- error 1345
--error ER_VIEW_NO_EXPLAIN
explain select c from mysqltest.v4;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
show create view mysqltest.v4;
# allow to see any view in mysqltest database
@ -222,14 +225,14 @@ select * from t1;
update v2 set a=a+c;
select * from t1;
# no rights on column
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
update v2 set c=a+c;
# no rights for view
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
update v3 set a=a+c;
use test;
@ -263,9 +266,9 @@ select * from t1;
delete v1 from t2,v1 where t2.x=v1.c;
select * from t1;
# no rights for view
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete v2 from t2,v2 where t2.x=v2.c;
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
delete from v2 where c < 4;
use test;
@ -299,9 +302,9 @@ select * from t1;
insert into v1 select x,y from t2;
select * from t1;
# no rights for view
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
insert into v2 values (5,6);
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
insert into v2 select x,y from t2;
use test;
@ -329,10 +332,10 @@ connection user1;
create view v1 as select * from mysqltest.t1;
create view v2 as select b from mysqltest.t2;
# There are not rights on mysqltest.v1
-- error 1142
--error ER_TABLEACCESS_DENIED_ERROR
create view mysqltest.v1 as select * from mysqltest.t1;
# There are not any rights on mysqltest.t2.a
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
create view v3 as select a from mysqltest.t2;
# give CREATE VIEW privileges (without any privileges for result column)
@ -352,13 +355,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
# Expression need select privileges
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2;
connection root;
grant create view,update,select on test.* to mysqltest_1@localhost;
connection user1;
-- error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
create view v4 as select b+1 from mysqltest.t2;
connection root;
@ -411,7 +414,7 @@ connection root;
# check view definer information
show create view v1;
revoke select on mysqltest.t1 from mysqltest_1@localhost;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v1;
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
@ -420,7 +423,7 @@ drop view v1;
drop database mysqltest;
#
# rights on execution of view underlying functiond (BUG#9505)
# rights on execution of view underlying functiond (Bug#9505)
#
connection root;
--disable_warnings
@ -453,11 +456,11 @@ connection user1;
use mysqltest;
select * from v1;
select * from v2;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v3;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
use test;
@ -505,13 +508,13 @@ use test;
connection root;
create view v5 as select * from v1;
revoke execute on function f2 from mysqltest_1@localhost;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v1;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v2;
select * from v3;
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
drop view v1, v2, v3, v4, v5;
@ -549,13 +552,13 @@ use test;
connection root;
revoke select on t1 from mysqltest_1@localhost;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v1;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v2;
select * from v3;
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
#drop view v1, v2, v3, v4, v5;
@ -588,11 +591,11 @@ connection user1;
use mysqltest;
select * from v1;
select * from v2;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v3;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v4;
-- error ER_VIEW_INVALID
--error ER_VIEW_INVALID
select * from v5;
use test;
@ -604,7 +607,7 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
drop database mysqltest;
#
# BUG#14256: definer in view definition is not fully qualified
# Bug#14256 definer in view definition is not fully qualified
#
--disable_warnings
drop view if exists v1;
@ -641,6 +644,7 @@ drop view v1;
select @v1def1, @v1def2, @v1def1=@v1def2;
connection root;
disconnect test14256;
drop user test14256;
# Restore the anonymous users.
@ -650,8 +654,8 @@ flush privileges;
drop table t1;
#
# BUG#14726: freeing stack variable in case of an error of opening
# a view when we have locked tables with LOCK TABLES statement.
# Bug#14726 freeing stack variable in case of an error of opening a view when
# we have locked tables with LOCK TABLES statement.
#
connection root;
--disable_warnings
@ -668,7 +672,7 @@ connection user1;
use mysqltest;
LOCK TABLES v1 READ;
-- error ER_TABLEACCESS_DENIED_ERROR
--error ER_TABLEACCESS_DENIED_ERROR
SHOW CREATE TABLE v1;
UNLOCK TABLES;
use test;
@ -679,7 +683,7 @@ drop user mysqltest_1@localhost;
drop database mysqltest;
#
# switch to default connaction
# switch to default connection
#
disconnect user1;
disconnect root;
@ -696,7 +700,7 @@ drop view v1;
drop view v2;
#
# Bug#18681: View privileges are broken
# Bug#18681 View privileges are broken
#
CREATE DATABASE mysqltest1;
CREATE USER readonly@localhost;
@ -717,54 +721,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
CONNECT (n1,localhost,readonly,,);
CONNECTION n1;
connect (n1,localhost,readonly,,);
connection n1;
--error 1356
--error ER_VIEW_INVALID
SELECT * FROM mysqltest1.v_t1;
--error 1356
--error ER_VIEW_INVALID
INSERT INTO mysqltest1.v_t1 VALUES(4);
--error 1356
--error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1 WHERE x = 1;
--error 1356
--error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
--error 1356
--error ER_VIEW_INVALID
UPDATE mysqltest1.v_t1 SET x = 3;
--error 1356
--error ER_VIEW_INVALID
DELETE FROM mysqltest1.v_t1;
--error 1356
--error ER_VIEW_INVALID
SELECT 1 FROM mysqltest1.v_t1;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.t1;
SELECT * FROM mysqltest1.v_ts;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM mysqltest1.v_ti;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
INSERT INTO mysqltest1.v_ts VALUES (100);
INSERT INTO mysqltest1.v_ti VALUES (100);
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
UPDATE mysqltest1.v_ts SET x= 200;
UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
UPDATE mysqltest1.v_tu SET x= 200;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts WHERE x= 200;
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_ts;
--error 1143
--error ER_COLUMNACCESS_DENIED_ERROR
DELETE FROM mysqltest1.v_td WHERE x= 200;
DELETE FROM mysqltest1.v_tds WHERE x= 200;
DELETE FROM mysqltest1.v_td;
CONNECTION default;
connection default;
disconnect n1;
DROP VIEW mysqltest1.v_tds;
DROP VIEW mysqltest1.v_td;
DROP VIEW mysqltest1.v_tus;
@ -777,21 +782,21 @@ DROP USER readonly@localhost;
DROP DATABASE mysqltest1;
#
# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
# Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
#
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
#--warning 1448
#--warning ER_VIEW_OTHER_USER
SHOW CREATE VIEW v;
--error 1449
--error ER_NO_SUCH_USER
SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
USE test;
#
# Bug#20363: Create view on just created view is now denied
# Bug#20363 Create view on just created view is now denied
#
eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
@ -822,6 +827,7 @@ SELECT * FROM view2;
SELECT * from view3;
connection default;
disconnect session1;
DROP VIEW mysqltest_db1.view3;
DROP VIEW mysqltest_db1.view2;
DROP VIEW mysqltest_db1.view1;
@ -829,8 +835,8 @@ DROP TABLE mysqltest_db1.t1;
DROP SCHEMA mysqltest_db1;
DROP USER mysqltest_db1@localhost;
#
# BUG#20482: failure on Create join view with sources views/tables
# in different schemas
# Bug#20482 failure on Create join view with sources views/tables
# in different schemas
#
--disable_warnings
CREATE DATABASE test1;
@ -840,7 +846,7 @@ CREATE DATABASE test2;
CREATE TABLE test1.t0 (a VARCHAR(20));
CREATE TABLE test2.t1 (a VARCHAR(20));
CREATE VIEW test2.t3 AS SELECT * FROM test1.t0;
CREATE OR REPLACE VIEW test.v1 AS
CREATE OR REPLACE VIEW test.v1 AS
SELECT ta.a AS col1, tb.a AS col2 FROM test2.t3 ta, test2.t1 tb;
DROP VIEW test.v1;
@ -851,8 +857,8 @@ DROP DATABASE test1;
#
# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER
# returns invoker name
# Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
# invoker name
#
--disable_warnings
DROP VIEW IF EXISTS v1;
@ -911,7 +917,7 @@ DROP USER mysqltest_u1@localhost;
#
# Bug#17254: Error for DEFINER security on VIEW provides too much info
# Bug#17254 Error for DEFINER security on VIEW provides too much info
#
connect (root,localhost,root,,);
connection root;
@ -935,12 +941,12 @@ DROP USER def_17254@localhost;
connect (inv,localhost,inv_17254,,db17254);
connection inv;
--echo for a user
--error 1142
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM v1;
connection root;
--echo for a superuser
--error 1449
--error ER_NO_SUCH_USER
SELECT * FROM v1;
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
@ -949,7 +955,7 @@ disconnect inv;
#
# BUG#24404: strange bug with view+permission+prepared statement
# Bug#24404 strange bug with view+permission+prepared statement
#
--disable_warnings
DROP DATABASE IF EXISTS mysqltest_db1;
@ -1017,8 +1023,8 @@ DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
#
# Bug#26813: The SUPER privilege is wrongly required to alter a view created
# by another user.
# Bug#26813 The SUPER privilege is wrongly required to alter a view created
# by another user.
#
connection root;
CREATE DATABASE db26813;
@ -1050,7 +1056,7 @@ DROP DATABASE db26813;
disconnect u1;
--echo #
--echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
--echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
--echo #
connection root;
CREATE DATABASE mysqltest_29908;
@ -1095,7 +1101,7 @@ disconnect u2;
--echo #######################################################################
#
# BUG#24040: Create View don't succed with "all privileges" on a database.
# Bug#24040 Create View don't succed with "all privileges" on a database.
#
# Prepare.
@ -1179,10 +1185,54 @@ SELECT * FROM mysqltest1.t4;
# Cleanup.
-- disconnect bug24040_con
disconnect bug24040_con;
DROP DATABASE mysqltest1;
DROP DATABASE mysqltest2;
DROP USER mysqltest_u1@localhost;
#
# Bug#41354 Access control is bypassed when all columns of a view are
# selected by * wildcard
CREATE DATABASE db1;
USE db1;
CREATE TABLE t1(f1 INT, f2 INT);
CREATE VIEW v1 AS SELECT f1, f2 FROM t1;
GRANT SELECT (f1) ON t1 TO foo;
GRANT SELECT (f1) ON v1 TO foo;
connect (addconfoo, localhost, foo,,);
connection addconfoo;
USE db1;
SELECT f1 FROM t1;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT f2 FROM t1;
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM t1;
SELECT f1 FROM v1;
--error ER_COLUMNACCESS_DENIED_ERROR
SELECT f2 FROM v1;
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM v1;
connection default;
disconnect root;
disconnect addconfoo;
USE test;
REVOKE SELECT (f1) ON db1.t1 FROM foo;
REVOKE SELECT (f1) ON db1.v1 FROM foo;
DROP USER foo;
DROP VIEW db1.v1;
DROP TABLE db1.t1;
DROP DATABASE db1;
connection default;
--echo End of 5.0 tests.
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@ -2,7 +2,7 @@
-- source include/not_embedded.inc
#
# Bug #8731: wait_timeout does not work on Mac OS X
# Bug#8731 wait_timeout does not work on Mac OS X
#
@ -87,6 +87,7 @@ while (!`select @aborted_clients`)
}
}
--enable_query_log
disconnect wait_con;
connection con1;
# When the connection is closed in this way, the error code should
@ -97,3 +98,5 @@ select 2;
--enable_reconnect
select 3;
disconnect con1;
# The last connect is to keep tools checking the current test happy.
connect (default,localhost,root,,test,,);

View File

@ -35,4 +35,35 @@ CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (1,1);
EXPLAIN SELECT * FROM t1 WHERE b = (SELECT max(2));
DROP TABLE t1;
#
# Bug #33813: Schema names are case-sensitive in DROP FUNCTION
#
CREATE DATABASE `TESTDB`;
USE `TESTDB`;
DELIMITER //;
CREATE FUNCTION test_fn() RETURNS INTEGER
BEGIN
DECLARE rId bigint;
RETURN rId;
END
//
CREATE FUNCTION test_fn2() RETURNS INTEGER
BEGIN
DECLARE rId bigint;
RETURN rId;
END
//
DELIMITER ;//
DROP FUNCTION `TESTDB`.`test_fn`;
DROP FUNCTION `testdb`.`test_fn2`;
USE test;
DROP DATABASE `TESTDB`;
--echo End of 5.0 tests.

View File

@ -2,6 +2,10 @@
# WL#1756
#
-- source include/have_innodb.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
@ -14,10 +18,10 @@ xa rollback 'test1';
select * from t1;
xa start 'test2';
--error 1399
--error ER_XAER_RMFAIL
xa start 'test-bad';
insert t1 values (20);
--error 1399
--error ER_XAER_RMFAIL
xa prepare 'test2';
xa end 'test2';
xa prepare 'test2';
@ -27,22 +31,22 @@ select * from t1;
xa start 'testa','testb';
insert t1 values (30);
--error 1399
--error ER_XAER_RMFAIL
commit;
xa end 'testa','testb';
--error 1399
--error ER_XAER_RMFAIL
begin;
--error 1399
--error ER_XAER_RMFAIL
create table t2 (a int);
connect (con1,localhost,root,,);
connection con1;
--error 1440
--error ER_XAER_DUPID
xa start 'testa','testb';
--error 1440
--error ER_XAER_DUPID
xa start 'testa','testb', 123;
# gtrid [ , bqual [ , formatID ] ]
@ -51,7 +55,7 @@ insert t1 values (40);
xa end 'testb',' 0@P`',11;
xa prepare 'testb',0x2030405060,11;
--error 1399
--error ER_XAER_RMFAIL
start transaction;
xa recover;
@ -64,11 +68,11 @@ xa prepare 'testa','testb';
xa recover;
--error 1397
--error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11;
xa rollback 'testa','testb';
--error 1064
--error ER_PARSE_ERROR
xa start 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz';
select * from t1;
@ -119,3 +123,7 @@ xa start 'a','c';
drop table t1;
--echo End of 5.0 tests
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc