summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/ctype_collate.test20
-rw-r--r--mysql-test/t/derived.test1
-rw-r--r--mysql-test/t/innodb.test8
-rw-r--r--mysql-test/t/rpl_relayrotate-slave.opt4
-rw-r--r--mysql-test/t/rpl_relayrotate.test61
-rw-r--r--mysql-test/t/subselect.test13
-rw-r--r--mysql-test/t/union.test2
-rw-r--r--mysql-test/t/variables.test4
8 files changed, 101 insertions, 12 deletions
diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test
index 431799ac65c..0b32c3ccf88 100644
--- a/mysql-test/t/ctype_collate.test
+++ b/mysql-test/t/ctype_collate.test
@@ -128,29 +128,29 @@ SHOW CREATE TABLE t1;
SHOW FIELDS FROM t1;
SET CHARACTER SET 'latin1';
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SET CHARACTER SET latin1;
-SHOW VARIABLES LIKE 'client_collation';
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
+SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET latin1 COLLATE latin1_bin;
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SET CHARACTER SET LATIN1 COLLATE Latin1_Bin;
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SET CHARACTER SET 'latin1' COLLATE 'latin1_bin';
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET koi8r;
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET koi8r COLLATE koi8r_bin;
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET koi8r COLLATE DEFAULT;
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
SET CHARACTER SET DEFAULT;
-SHOW VARIABLES LIKE 'client_collation';
+SHOW VARIABLES LIKE 'collation_client';
SELECT charset('a'),collation('a'),coercibility('a'),'a'='A';
--error 1251
SET CHARACTER SET latin1 COLLATE koi8r;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 8b8d9e4d1a2..2ce90c93bd9 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -41,6 +41,7 @@ CREATE TABLE t2 (a int not null);
insert into t2 values(1);
select * from (select * from t1 where t1.a=(select a from t2 where t2.a=t1.a)) a;
select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a) union select t1.a, t1.b from t1) a;
+explain select * from (select * from t1,t2 where t1.a=t2.a) t1;
drop table t1, t2;
create table t1(a int not null, t char(8), index(a));
disable_query_log;
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 4d1a620d67f..9773d1ec17c 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -805,3 +805,11 @@ select * from t1;
select * from t2;
drop table t1,t2;
+CREATE TABLE t1 (col1 int(1))TYPE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP(+0),INDEX stamp_idx
+(stamp))TYPE=InnoDB;
+insert into t1 values (1),(2),(3);
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 );
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+drop table t1,t2;
diff --git a/mysql-test/t/rpl_relayrotate-slave.opt b/mysql-test/t/rpl_relayrotate-slave.opt
new file mode 100644
index 00000000000..8b671423363
--- /dev/null
+++ b/mysql-test/t/rpl_relayrotate-slave.opt
@@ -0,0 +1,4 @@
+-O max_binlog_size=16384
+--innodb
+--log-warnings
+
diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test
new file mode 100644
index 00000000000..4c330b8c9a2
--- /dev/null
+++ b/mysql-test/t/rpl_relayrotate.test
@@ -0,0 +1,61 @@
+# When the relay log gets rotated while the I/O thread
+# is reading a transaction, the transaction spans on two or more
+# relay logs. If STOP SLAVE occurs while the SQL thread is
+# executing a part of the transaction in the non-first relay logs,
+# we test if START SLAVE will resume in the beginning of the
+# transaction (i.e., step back to the first relay log)
+
+# The slave is started with max_binlog_size=16384 bytes,
+# to force many rotations (approximately 30 rotations)
+
+# If the master or slave does not support InnoDB, this test will pass
+
+source include/master-slave.inc;
+connection slave;
+stop slave;
+connection master;
+create table t1 (a int) type=innodb;
+let $1=8000;
+disable_query_log;
+begin;
+while ($1)
+{
+# eval means expand $ expressions
+ eval insert into t1 values( $1 );
+ dec $1;
+}
+commit;
+# This will generate a 500kB master's binlog,
+# which corresponds to 30 slave's relay logs.
+enable_query_log;
+save_master_pos;
+connection slave;
+reset slave;
+start slave;
+# We wait 1 sec for the SQL thread to be somewhere in
+# the middle of the transaction, hopefully not in
+# the first relay log, and hopefully before the COMMIT.
+# Usually it stops when the SQL thread is around the 15th relay log.
+# We cannot use MASTER_POS_WAIT() as master's position
+# increases only when the slave executes the COMMIT.
+system sleep 1;
+stop slave;
+# We suppose the SQL thread stopped before COMMIT.
+# If so the transaction was rolled back
+# and the table is now empty.
+# Now restart
+start slave;
+# And see if the table contains '8000'
+# which proves that the transaction restarted at
+# the right place.
+# We must wait for the transaction to commit before
+# reading, MASTER_POS_WAIT() will do it for sure
+# (the only statement with position>=3000 is COMMIT).
+# Older versions of MySQL would hang forever in MASTER_POS_WAIT
+# because COMMIT was said to be position 0 in the master's log (bug).
+# Detect this with timeout.
+select master_pos_wait('master-bin.001',3000,120)=-1;
+select * from t1 where a=8000;
+# Note that the simple fact to have less than around 30 slave's binlogs
+# (the slave is started with --log-slave-updates) is already
+# a proof that the transaction was not properly resumed.
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index e6ae86aa839..dffe6ec79c2 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -244,6 +244,11 @@ select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1);
select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1);
drop table t1;
+create table t1 (a int);
+insert into t1 values (1),(2),(3);
+(select * from t1) union (select * from t1) order by (select a from t1 limit 1);
+drop table t1;
+
#iftest
CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b');
INSERT INTO t1 VALUES ();
@@ -690,3 +695,11 @@ INSERT INTO t2 VALUES (4,'vita'), (1,'vita'), (2,'vita'), (1,'vita');
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1);
select * from t2;
drop table t1,t2;
+
+#
+# correct NULL in <CONSTANT> IN (SELECT ...)
+#
+create table t1 (a int, unique index indexa (a));
+insert into t1 values (-1), (-4), (-2), (NULL);
+select -10 IN (select a from t1 FORCE INDEX (indexa));
+drop table t1;
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index d2f35b59f54..70e770cd2d3 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -146,3 +146,5 @@ drop table t1,t2;
(select 1) union (select 2) order by 0;
SELECT @a:=1 UNION SELECT @a:=@a+1;
+--error 1054
+(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index bb94ab17b77..d1c8df64be2 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -92,7 +92,7 @@ set net_buffer_length=2000000000;
show variables like 'net_buffer_length';
set character set cp1251_koi8;
-show variables like "client_collation";
+show variables like "collation_client";
select @@timestamp>0;
set @@rand_seed1=10000000,@@rand_seed2=1000000;
@@ -119,7 +119,7 @@ set SESSION query_cache_size=10000;
--error 1230
set GLOBAL table_type=DEFAULT;
--error 1115
-set client_collation=UNKNOWN_CHARACTER_SET;
+set collation_client=UNKNOWN_CHARACTER_SET;
--error 1228
set global autocommit=1;
--error 1228