summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/bdb-deadlock.tminus57
-rw-r--r--mysql-test/t/ctype_ucs.test4
-rw-r--r--mysql-test/t/endspace.test8
-rw-r--r--mysql-test/t/grant.test13
-rw-r--r--mysql-test/t/heap.test10
-rw-r--r--mysql-test/t/insert_select.test13
-rw-r--r--mysql-test/t/ndb_charset.test10
-rw-r--r--mysql-test/t/ps.test1
-rw-r--r--mysql-test/t/rpl_charset.test6
-rw-r--r--mysql-test/t/rpl_create_database-master.opt1
-rw-r--r--mysql-test/t/rpl_create_database-slave.opt1
-rw-r--r--mysql-test/t/rpl_create_database.test70
-rw-r--r--mysql-test/t/rpl_until.test2
-rw-r--r--mysql-test/t/type_enum.test41
14 files changed, 225 insertions, 12 deletions
diff --git a/mysql-test/t/bdb-deadlock.tminus b/mysql-test/t/bdb-deadlock.tminus
new file mode 100644
index 00000000000..d86403fcffc
--- /dev/null
+++ b/mysql-test/t/bdb-deadlock.tminus
@@ -0,0 +1,57 @@
+# This test doesn't work with the embedded version as this code
+# assumes that one query is running while we are doing queries on
+# a second connection.
+# This would work if mysqltest run would be threaded and handle each
+# connection in a separate thread.
+#
+
+#-- source include/not_embedded.inc
+-- source include/have_bdb.inc
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+connection con1;
+create table t1 (id integer, x integer) engine=BDB;
+create table t2 (id integer, x integer) engine=BDB;
+insert into t1 values(0, 0);
+insert into t2 values(0, 0);
+set autocommit=0;
+update t1 set x = 1 where id = 0;
+
+connection con2;
+set autocommit=0;
+update t2 set x = 1 where id = 0;
+
+# The following query should hang because con1 is locking the page
+--send
+select x from t1 where id = 0;
+
+connection con1;
+# This should generate a deadlock as we are trying to access a locked row
+--send
+select x from t2 where id = 0;
+
+connection con2;
+--error 1213
+reap;
+commit;
+
+connection con1;
+reap;
+commit;
+
+connection con2;
+select * from t1;
+select * from t2;
+commit;
+
+connection con1;
+select * from t1;
+select * from t2;
+commit;
+
+drop table t1,t2;
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 0b8678ef59b..b1d872c58a5 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -4,6 +4,10 @@
DROP TABLE IF EXISTS t1;
--enable_warnings
+SET NAMES latin1;
+SET character_set_connection=ucs2;
+-- source include/endspace.inc
+
SET CHARACTER SET koi8r;
#
diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test
index 9ee5e32967a..462bc3083e1 100644
--- a/mysql-test/t/endspace.test
+++ b/mysql-test/t/endspace.test
@@ -7,13 +7,7 @@
drop table if exists t1;
--enable_warnings
-select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
-select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
-select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
-select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
-select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
-select 'a a' > 'a', 'a \0' < 'a';
-select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
+-- source include/endspace.inc
#
# Test MyISAM tables.
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index 963b9ae5080..169dd03ad86 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -267,3 +267,16 @@ DROP DATABASE testdb8;
DROP DATABASE testdb9;
DROP DATABASE testdb10;
+#
+# Bug #6932: a problem with 'revoke ALL PRIVILEGES'
+#
+
+create table t1(a int, b int, c int, d int);
+grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
+show grants for grant_user@localhost;
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+revoke ALL PRIVILEGES on t1 from grant_user@localhost;
+show grants for grant_user@localhost;
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+drop user grant_user@localhost;
+drop table t1;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 2eff36f3317..bc0b28370ec 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -185,3 +185,13 @@ DELETE FROM t1 WHERE date<1101106546;
SELECT * FROM t1;
DROP TABLE t1;
+#
+# Bug #6878: a problem with small length records
+#
+
+create table t1(a char(2)) engine=memory;
+insert into t1 values (NULL), (NULL);
+delete from t1 where a is null;
+insert into t1 values ('2'), ('3');
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index db5dc8d91da..e1459310bb9 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -89,6 +89,19 @@ show binlog events;
select * from t1;
drop table t1, t2;
+# Verify that a partly-completed CREATE TABLE .. SELECT does not
+# get into the binlog (Bug #6682)
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+--error 1062
+create table t2(unique(a)) select a from t1;
+# The above should produce an error, *and* not appear in the binlog
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+show binlog events;
+drop table t1;
+
#
# Test of insert ... select from same table
#
diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test
index f1ec0485e12..1b9e7e8bfcc 100644
--- a/mysql-test/t/ndb_charset.test
+++ b/mysql-test/t/ndb_charset.test
@@ -157,3 +157,13 @@ select * from t1 where a = 'AaA' order by p;
# 6
select * from t1 where a = 'AAA' order by p;
drop table t1;
+
+# bug
+create table t1 (
+ a varchar(10) primary key
+) engine=ndb;
+insert into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+select * from t1;
+drop table t1;
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index 7fe88ad0ddc..51d1fd065cf 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -471,4 +471,3 @@ execute stmt using @var, @var, @var;
set @var=null;
select @var is null, @var is not null, @var;
execute stmt using @var, @var, @var;
-
diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test
index 9b9f53a94de..68036ae49f1 100644
--- a/mysql-test/t/rpl_charset.test
+++ b/mysql-test/t/rpl_charset.test
@@ -154,9 +154,9 @@ select hex(c1), hex(c2) from t1;
stop slave;
delete from t1;
-change master to master_log_pos=5801;
-start slave until master_log_file='master-bin.000001', master_log_pos=5937;
-# Slave is supposed to stop _after_ the INSERT, even though 5937 is
+change master to master_log_pos=5847;
+start slave until master_log_file='master-bin.000001', master_log_pos=5983;
+# Slave is supposed to stop _after_ the INSERT, even though 5983 is
# the position of the beginning of the INSERT; after SET slave is not
# supposed to increment position.
wait_for_slave_to_stop;
diff --git a/mysql-test/t/rpl_create_database-master.opt b/mysql-test/t/rpl_create_database-master.opt
new file mode 100644
index 00000000000..85660a17140
--- /dev/null
+++ b/mysql-test/t/rpl_create_database-master.opt
@@ -0,0 +1 @@
+--binlog-do-db=mysqltest_sisyfos --binlog-do-db=mysqltest_prometheus
diff --git a/mysql-test/t/rpl_create_database-slave.opt b/mysql-test/t/rpl_create_database-slave.opt
new file mode 100644
index 00000000000..96d630c9229
--- /dev/null
+++ b/mysql-test/t/rpl_create_database-slave.opt
@@ -0,0 +1 @@
+--replicate-do-db=mysqltest_sisyfos --replicate-do-db=mysqltest_prometheus
diff --git a/mysql-test/t/rpl_create_database.test b/mysql-test/t/rpl_create_database.test
new file mode 100644
index 00000000000..7ed0d5dbdbb
--- /dev/null
+++ b/mysql-test/t/rpl_create_database.test
@@ -0,0 +1,70 @@
+#
+# Tests for replication of statements that manipulate databases.
+#
+# For this test file, we have a number of databases. All databases
+# with "greek" names will be replicated on the slave, while other names
+# (e.g., american) will not be replicated.
+#
+
+source include/master-slave.inc;
+
+# Bug#6391 (binlog-do-db rules ignored)
+# In this case, 'mysqltest_bob' should not be replicated to the slave.
+--disable_warnings
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
+# This database is not replicated
+DROP DATABASE IF EXISTS mysqltest_bob;
+--enable_warnings
+
+connection master;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+
+USE mysqltest_sisyfos;
+# These should be replicated
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+
+USE mysqltest_bob;
+# These should *not* be replicated
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+
+# Current database is now 'mysqltest_bob'
+# The following should be replicated
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+
+USE mysqltest_sisyfos;
+# The following should *not* be replicated
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+SHOW BINLOG EVENTS;
+SHOW DATABASES;
+sync_slave_with_master;
+SHOW DATABASES;
+SHOW CREATE TABLE mysqltest_prometheus.t1;
+SHOW CREATE TABLE mysqltest_sisyfos.t2;
+
+connection master;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test
index 5eaec0727b6..45b343ace14 100644
--- a/mysql-test/t/rpl_until.test
+++ b/mysql-test/t/rpl_until.test
@@ -43,7 +43,7 @@ show slave status;
# try replicate all until second insert to t2;
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537;
-sleep 2;
+sleep 4;
select * from t2;
--replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 9 # 23 # 33 #
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index dc2e4d0f469..3a5b12b91e4 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -72,3 +72,44 @@ CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
SELECT * FROM t1;
DROP TABLE t1;
+
+#
+# Bug #6379: ENUM values are incorrectly converted
+#
+# Check latin1 -> utf8 conversion
+#
+CREATE TABLE t1 (
+ a ENUM('ä','ö','ü') character set utf8 default 'ü'
+);
+show create table t1;
+insert into t1 values ('ä'), ('ö'), ('ü');
+select a from t1 order by a;
+drop table t1;
+
+#
+# Now check utf8 -> latin1 conversion
+# This test emulates loading a script generated with mysqldump
+#
+set names utf8;
+CREATE TABLE t1 (
+ a ENUM('ä','ö','ü') character set latin1 default 'ü'
+);
+insert into t1 values ('ä'),('ö'),('ü');
+# Now check what has been loaded
+set names latin1;
+show create table t1;
+select a from t1 order by a;
+drop table t1;
+
+#
+# Test bug where enum fields where extended for each ALTER TABLE
+#
+
+create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
+insert into t1 values ('Y');
+alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+--enable_metadata
+select * from t1;
+--disable metadata
+drop table t1;