diff options
author | hf@deer.mysql.r18.ru <> | 2003-01-15 13:15:35 +0400 |
---|---|---|
committer | hf@deer.mysql.r18.ru <> | 2003-01-15 13:15:35 +0400 |
commit | 96089e2b3a013c83e812672284bf10a34ba9d11c (patch) | |
tree | 937beb6f27e5e7958081a4a5ba13ceb2f5251396 /mysql-test | |
parent | c59bff7c96bf90c9c4dafdb80684fb438bb43734 (diff) | |
parent | 809af00b0672242cc1b0fee114a34f414ec9055a (diff) | |
download | mariadb-git-96089e2b3a013c83e812672284bf10a34ba9d11c.tar.gz |
resolving conflicts
Diffstat (limited to 'mysql-test')
256 files changed, 1968 insertions, 909 deletions
diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index 1013cd2cd52..008466c426f 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -7,12 +7,16 @@ connection slave; !stop slave; @r/slave-stopped.result show status like 'Slave_running'; connection master; +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings reset master; connection slave; reset slave; # Clean up old test tables +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +--enable_warnings start slave; @r/slave-running.result show status like 'Slave_running'; diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index edfff5c4d46..edd573f50a3 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -88,6 +88,7 @@ sleep_until_file_created () wait_for_pid() { pid=$1 + #$WAIT_PID pid $SLEEP_TIME_FOR_DELETE } # No paths below as we can't be sure where the program is! @@ -347,9 +348,9 @@ while test $# -gt 0; do ;; --debug) EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT \ - --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/master.trace" + --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/master.trace" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT \ - --debug=d:t:i:O,$MYSQL_TEST_DIR/var/log/slave.trace" + --debug=d:t:i:A,$MYSQL_TEST_DIR/var/log/slave.trace" EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT --debug" ;; --fast) @@ -423,6 +424,7 @@ if [ x$SOURCE_DIST = x1 ] ; then fi MYSQLADMIN="$BASEDIR/client/mysqladmin" + WAIT_PID="$BASEDIR/extra/mysql_waitpid" MYSQL_MANAGER_CLIENT="$BASEDIR/client/mysqlmanagerc" MYSQL_MANAGER="$BASEDIR/tools/mysqlmanager" MYSQL_MANAGER_PWGEN="$BASEDIR/client/mysqlmanager-pwgen" @@ -439,6 +441,7 @@ else fi MYSQL_TEST="$BASEDIR/bin/mysqltest" MYSQLADMIN="$BASEDIR/bin/mysqladmin" + WAIT_PID="$BASEDIR/bin/mysql_waitpid" MYSQL_MANAGER="$BASEDIR/bin/mysqlmanager" MYSQL_MANAGER_CLIENT="$BASEDIR/bin/mysqlmanagerc" MYSQL_MANAGER_PWGEN="$BASEDIR/bin/mysqlmanager-pwgen" @@ -753,9 +756,9 @@ manager_term() { pid=$1 ident=$2 - shift if [ $USE_MANAGER = 0 ] ; then - $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=20 shutdown >> $MYSQL_MANAGER_LOG 2>&1 + # Shutdown time must be high as slave may be in reconnect + $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=5 --shutdown_timeout=70 shutdown >> $MYSQL_MANAGER_LOG 2>&1 res=$? # Some systems require an extra connect $MYSQLADMIN --no-defaults -uroot --socket=$MYSQL_TMP_DIR/$ident.sock --connect_timeout=1 ping >> $MYSQL_MANAGER_LOG 2>&1 @@ -778,8 +781,6 @@ start_master() if [ x$MASTER_RUNNING = x1 ] || [ x$LOCAL_MASTER = x1 ] ; then return fi - # Remove old berkeley db log files that can confuse the server - $RM -f $MASTER_MYDDIR/log.* # Remove stale binary logs $RM -f $MYSQL_TEST_DIR/var/log/master-bin.* # Remove old master.info files @@ -877,8 +878,8 @@ start_slave() [ x$SKIP_SLAVE = x1 ] && return eval "this_slave_running=\$SLAVE$1_RUNNING" [ x$this_slave_running = 1 ] && return - #when testing fail-safe replication, we will have more than one slave - #in this case, we start secondary slaves with an argument + # When testing fail-safe replication, we will have more than one slave + # in this case, we start secondary slaves with an argument slave_ident="slave$1" if [ -n "$1" ] ; then @@ -986,9 +987,12 @@ EOF mysql_start () { - $ECHO "Starting MySQL daemon" - start_master - start_slave +# We should not start the deamon here as we don't know the argumens +# for the test. Better to let the test start the deamon + +# $ECHO "Starting MySQL daemon" +# start_master +# start_slave cd $MYSQL_TEST_DIR return 1 } @@ -1089,8 +1093,6 @@ run_testcase () slave_init_script=$TESTDIR/$tname-slave.sh slave_master_info_file=$TESTDIR/$tname-slave-master-info.opt echo $tname > $CURRENT_TEST - echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR - echo "CURRENT_TEST: $tname" >> $MASTER_MYERR SKIP_SLAVE=`$EXPR \( $tname : rpl \) = 0` if [ $USE_MANAGER = 1 ] ; then many_slaves=`$EXPR \( $tname : rpl_failsafe \) != 0` @@ -1127,13 +1129,17 @@ run_testcase () then EXTRA_MASTER_OPT=`$CAT $master_opt_file | $SED -e "s;\\$MYSQL_TEST_DIR;$MYSQL_TEST_DIR;"` stop_master + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master else if [ ! -z "$EXTRA_MASTER_OPT" ] || [ x$MASTER_RUNNING != x1 ] ; then EXTRA_MASTER_OPT="" stop_master + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR start_master + else + echo "CURRENT_TEST: $tname" >> $MASTER_MYERR fi fi @@ -1163,7 +1169,10 @@ run_testcase () if [ x$do_slave_restart = x1 ] ; then stop_slave + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR start_slave + else + echo "CURRENT_TEST: $tname" >> $SLAVE_MYERR fi if [ x$many_slaves = x1 ]; then start_slave 1 @@ -1286,6 +1295,9 @@ then # Remove files that can cause problems $RM -f $MYSQL_TEST_DIR/var/run/* $MYSQL_TEST_DIR/var/tmp/* + # Remove old berkeley db log files that can confuse the server + $RM -f $MASTER_MYDDIR/log.* + wait_for_master=$SLEEP_TIME_FOR_FIRST_MASTER wait_for_slave=$SLEEP_TIME_FOR_FIRST_SLAVE $ECHO "Installing Test Databases" diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index cba486109ac..456dfa860df 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -50,10 +50,10 @@ PRIMARY KEY (GROUP_ID,LANG_ID), KEY NAME (NAME)); ALTER TABLE t1 CHANGE NAME NAME CHAR(80) not null; SHOW FULL COLUMNS FROM t1; -Field Type Null Key Default Extra Privileges Comment -GROUP_ID int(10) unsigned PRI 0 select,insert,update,references -LANG_ID smallint(5) unsigned PRI 0 select,insert,update,references -NAME char(80) character set latin1 MUL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +GROUP_ID int(10) unsigned binary PRI 0 select,insert,update,references +LANG_ID smallint(5) unsigned binary PRI 0 select,insert,update,references +NAME char(80) latin1 MUL select,insert,update,references DROP TABLE t1; create table t1 (n int); insert into t1 values(9),(3),(12),(10); @@ -118,7 +118,7 @@ create table t1 (i int unsigned not null auto_increment primary key); alter table t1 rename t2; alter table t2 rename t1, add c char(10) comment "no comment"; show columns from t1; -Field Type Null Key Default Extra -i int(10) unsigned PRI NULL auto_increment -c char(10) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +i int(10) unsigned binary PRI NULL auto_increment +c char(10) latin1 YES NULL drop table t1; diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result index 43d57d2d4f7..e4f41517f94 100644 --- a/mysql-test/r/backup.result +++ b/mysql-test/r/backup.result @@ -1,5 +1,5 @@ set SQL_LOG_BIN=0; -drop table if exists t1; +drop table if exists t1, t2, t3; create table t1(n int); backup table t1 to '../bogus'; Table Op Msg_type Msg_text diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result index ef4dfc307bf..2c7d3136369 100644 --- a/mysql-test/r/bdb.result +++ b/mysql-test/r/bdb.result @@ -797,7 +797,6 @@ select * from t1 where i=1 and j=2; i j 1 2 drop table t1; -drop table if exists t1, t2, t3, t4, t5, t6, t7; create table t1 ( branch_id int auto_increment primary key, @@ -806,7 +805,6 @@ branch_active int not null default 1, unique branch_name(branch_name), index branch_active(branch_active) ) type=bdb; -drop table if exists t2 ; create table t2 ( target_id int auto_increment primary key, @@ -815,7 +813,6 @@ target_active int not null default 1, unique target_name(target_name), index target_active(target_active) ) type=bdb; -drop table if exists t3 ; create table t3 ( platform_id int auto_increment primary key, @@ -824,7 +821,6 @@ platform_active int not null default 1, unique platform_name(platform_name), index platform_active(platform_active) ) type=bdb; -drop table if exists t4 ; create table t4 ( product_id int auto_increment primary key, @@ -834,7 +830,6 @@ product_active int not null default 1, unique product_name(product_name), index product_active(product_active) ) type=bdb; -drop table if exists t5 ; create table t5 ( product_file_id int auto_increment primary key, @@ -847,7 +842,6 @@ file_included int not null default 1, unique product_file(product_id,file_name), index file_included(file_included) ) type=bdb; -drop table if exists t6 ; create table t6 ( file_platform_id int auto_increment primary key, @@ -860,7 +854,6 @@ build_filename varchar(255) not null, archive_filename varchar(255) not null, unique file_platform(product_file_id,platform_id,branch_id) ) type=bdb; -drop table if exists t8 ; create table t8 ( archive_id int auto_increment primary key, @@ -872,7 +865,6 @@ status_id int not null default 1, unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) ) type=bdb; -drop table if exists t7 ; create table t7 ( build_id int auto_increment primary key, @@ -1057,7 +1049,6 @@ KINMU_DATE select T1.KINMU_DATE from t1 T1 ,t2 T2 where T1.SYAIN_NO = '12345' and T1.KINMU_DATE = '200106' and T2.SYAIN_NO = T1.SYAIN_NO; KINMU_DATE DROP TABLE t1,t2; -drop table if exists t1; create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 6afa74d20e2..8bc383c6f4c 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; 0 256 00000000000000065536 2147483647 -2147483648 2147483648 +4294967296 0 256 65536 2147483647 -2147483648 2147483648 4294967296 @@ -7,7 +8,6 @@ select 9223372036854775807,-009223372036854775808; select +9999999999999999999,-9999999999999999999; +9999999999999999999 -9999999999999999999 10000000000000000000 -10000000000000000000 -drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/r/bool.result b/mysql-test/r/bool.result index cb82c6baa0f..890c85dc946 100644 --- a/mysql-test/r/bool.result +++ b/mysql-test/r/bool.result @@ -46,10 +46,9 @@ SELECT @a, @b; @a @b 0 6 DROP TABLE t1; -drop table if exists t; -create table t(a int, b int); -insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); -select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t; +create table t1 (a int, b int); +insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); +select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1; A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB N N N N N N N N N N 0 N 1 N 0 1 1 N N N @@ -60,7 +59,7 @@ N 1 N 0 N N N 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 -select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t; +select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1; A B nA nB AB n(AB) nAonB AoB n(AoB) nAnB N N N N N N N N N N 0 N 1 N 0 1 1 N N N @@ -71,4 +70,4 @@ N 1 N 0 N N N 1 0 0 0 1 1 0 0 1 1 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 0 0 -drop table t; +drop table t1; diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result index 18241a8fcc1..914e05efa7a 100644 --- a/mysql-test/r/case.result +++ b/mysql-test/r/case.result @@ -63,3 +63,11 @@ nothing 2 one 1 two 1 drop table t1; +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; +color +orange +yellow +green +drop table t1; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 0be0d624fca..5228ae50a83 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1,4 +1,4 @@ -drop table if exists t1,t2; +drop table if exists t1,t2,t3; create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -13,12 +13,15 @@ select * from t1; b -drop table if exists t1; +drop table t1; create table t2 type=heap select * from t1; Table 'test.t1' doesn't exist create table t2 select auto+1 from t1; Table 'test.t1' doesn't exist drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' +Note 1051 Unknown table 't2' create table t1 (b char(0) not null, index(b)); The used table handler can't index column 'b' create table t1 (a int not null auto_increment,primary key (a)) type=heap; @@ -48,6 +51,8 @@ drop table 1ea10; create table t1 (t1.index int); drop table t1; drop database if exists test_$1; +Warnings: +Note 1008 Can't drop database 'test_$1'. Database doesn't exist create database test_$1; create table test_$1.$test1 (a$1 int, $b int, c$ int); insert into test_$1.$test1 values (1,2,3); @@ -70,47 +75,53 @@ drop table t1,t2; create table t1(x varchar(50) ); create table t2 select x from t1 where 1=2; describe t1; -Field Type Null Key Default Extra -x varchar(50) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +x varchar(50) latin1 YES NULL describe t2; -Field Type Null Key Default Extra -x char(50) character set latin1 YES NULL +Field Type Collation Null Key Default Extra +x char(50) latin1 YES NULL drop table t2; create table t2 select now() as a , curtime() as b, curdate() as c , 1+1 as d , 1.0 + 1 as e , 33333333333333333 + 3 as f; describe t2; -Field Type Null Key Default Extra -a datetime 0000-00-00 00:00:00 -b time 00:00:00 -c date 0000-00-00 -d bigint(17) 0 -e double(18,1) 0.0 -f bigint(17) 0 +Field Type Collation Null Key Default Extra +a datetime latin1 0000-00-00 00:00:00 +b time latin1 00:00:00 +c date latin1 0000-00-00 +d bigint(17) binary 0 +e double(18,1) binary 0.0 +f bigint(17) binary 0 drop table t2; create table t2 select CAST("2001-12-29" AS DATE) as d, CAST("20:45:11" AS TIME) as t, CAST("2001-12-29 20:45:11" AS DATETIME) as dt; describe t2; -Field Type Null Key Default Extra -d date 0000-00-00 -t time 00:00:00 -dt datetime 0000-00-00 00:00:00 +Field Type Collation Null Key Default Extra +d date latin1 0000-00-00 +t time latin1 00:00:00 +dt datetime latin1 0000-00-00 00:00:00 drop table t1,t2; create table t1 (a tinyint); create table t2 (a int) select * from t1; describe t1; -Field Type Null Key Default Extra -a tinyint(4) YES NULL +Field Type Collation Null Key Default Extra +a tinyint(4) binary YES NULL describe t2; -Field Type Null Key Default Extra -a int(11) YES NULL +Field Type Collation Null Key Default Extra +a int(11) binary YES NULL drop table if exists t2; create table t2 (a int, a float) select * from t1; Duplicate column name 'a' drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' create table t2 (a int) select a as b, a+1 as b from t1; Duplicate column name 'b' drop table if exists t2; +Warnings: +Note 1051 Unknown table 't2' create table t2 (b int) select a as b, a+1 as b from t1; Duplicate column name 'b' drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't2' create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b), key (b)); show create table t1; Table Create Table @@ -161,3 +172,75 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +create table if not exists t3 like t1; +Warnings: +Warning 1050 Table 't3' already exists +select @@warning_count; +@@warning_count +1 +create temporary table t3 like t2; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0' +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id +drop table t3; +show create table t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t3; +id name +drop table t2, t3; +drop database if exists test_$1; +Warnings: +Note 1008 Can't drop database 'test_$1'. Database doesn't exist +create database test_$1; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +Table Create Table +t3 CREATE TEMPORARY TABLE `t3` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +create table t2 like t3; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL default '0', + `name` char(20) default NULL +) TYPE=MyISAM CHARSET=latin1 +select * from t2; +id name +create table t3 like t1; +create table t3 like test_$1.t3; +Table 't3' already exists +create table non_existing_database.t1 like t1; +Got one of the listed errors +create table t3 like non_existing_table; +Unknown table 'non_existing_table' +create temporary table t3 like t1; +Table 't3' already exists +create table t3 like `a/a`; +Incorrect table name 'a/a' +drop table t1, t2, t3; +drop table t3; +drop database test_$1; diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result index 45fe91c096d..91a43634bcb 100644 --- a/mysql-test/r/ctype_many.result +++ b/mysql-test/r/ctype_many.result @@ -1,45 +1,45 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, -koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL +koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin1 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '', - `latin5_f` char(32) character set latin5 NOT NULL default '' + `koi8_ru_f` char(32) character set koi8r NOT NULL default '', + `latin5_f` char(32) NOT NULL default '' ) TYPE=MyISAM CHARSET=latin5 ALTER TABLE t1 CHARSET=latin2; ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '', + `comment` char(32) NOT NULL default '', + `koi8_ru_f` char(32) character set koi8r NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL default '', - `latin2_f` char(32) character set latin2 NOT NULL default '' + `latin2_f` char(32) NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 ALTER TABLE t1 DROP latin2_f, DROP latin5_f; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `comment` char(32) character set latin2 NOT NULL default '', - `koi8_ru_f` char(32) character set koi8_ru NOT NULL default '' + `comment` char(32) NOT NULL default '', + `koi8_ru_f` char(32) character set koi8r NOT NULL default '' ) TYPE=MyISAM CHARSET=latin2 INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); @@ -336,6 +336,11 @@ CYR CAPIT SOFT SIGN ø Ь CYR CAPIT E ü Ð CYR CAPIT YU à Ю CYR CAPIT YA ñ Я +ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL; +UPDATE t1 SET bin_f=koi8_ru_f; +SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; +COUNT(DISTINCT bin_f) COUNT(DISTINCT koi8_ru_f) COUNT(DISTINCT utf8_f) +116 58 57 SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1; koi8_ru_f MIN(comment) a LAT CAPIT A @@ -1056,7 +1061,7 @@ CYR SMALL YA CYR CAPIT YA CYR SMALL YA CYR SMALL YA SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r) ORDER BY t12.utf8_f,t11.comment,t12.comment; comment comment LAT CAPIT A LAT CAPIT A diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result index 351798b0509..4fa85ea9cbc 100644 --- a/mysql-test/r/delete.result +++ b/mysql-test/r/delete.result @@ -24,7 +24,6 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a)); insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27); delete from t1 where a=27; drop table t1; -drop table if exists t; CREATE TABLE `t` ( `i` int(10) NOT NULL default '0', `i2` int(10) NOT NULL default '0', diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 03e00b206b2..4f16e239e15 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -1,4 +1,11 @@ drop table if exists t1,t2,t3; +select * from (select 2 from DUAL) b; +2 +2 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +Unknown column 'a' in 'field list' CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -53,7 +60,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY x1 ALL NULL NULL NULL NULL 4 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 2 DERIVED x1 ALL NULL NULL NULL NULL 4 -drop table if exists t1.t2,t3; +drop table if exists t2,t3; select * from (select 1) as a; 1 1 @@ -116,10 +123,16 @@ explain select count(*) from t1 as tt1, (select * from t1) as tt2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away 2 DERIVED tt1 index NULL a 4 NULL 10000 Using index -drop table if exists t1; +drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; (SELECT * FROM (SELECT 1 as a) as a ) 1 select * from (select 1 as a) b left join (select 2 as a) c using(a); a a 1 NULL +SELECT * FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +Unknown column 'a' in 'field list' +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +Unknown column 'a' in 'field list' diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index aefcba9ed9d..ae1d9588bc7 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -326,7 +326,6 @@ AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2)); id 2 drop table t1,t2,t3; -drop table if exists t1; create table t1 (a int not null, b int not null, t time); insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15"); select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b; @@ -410,7 +409,7 @@ INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http:// SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); privatemessageid folderid userid touserid fromuserid title message dateline showsignature iconid messageread readtime receipt deleteprompt multiplerecipients userid usergroupid username password email styleid parentemail coppauser homepage icq aim yahoo signature adminemail showemail invisible usertitle customtitle joindate cookieuser daysprune lastvisit lastactivity lastpost posts timezoneoffset emailnotification buddylist ignorelist pmfolders receivepm emailonpm pmpopup avatarid avatarrevision options birthday maxposts startofweek ipaddress referrerid nosessionhash autorefresh messagepopup inforum ratenum ratetotal allowrate 128 0 33 33 8 :D 996121863 1 0 2 996122850 2 0 0 33 6 Kevin 0 kevin@stileproject.com 1 0 http://www.stileproject.com 1 1 0 Administrator 0 996120694 1 -1 1030996168 1031027028 1030599436 36 -6 0 1 0 1 0 0 15 0000-00-00 -1 1 64.0.0.0 0 1 -1 0 0 4 19 1 -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; CREATE TABLE t1 (a int primary key, b int, c int); INSERT t1 VALUES (1,2,3); CREATE TABLE t2 (a int primary key, b int, c int); @@ -418,4 +417,4 @@ INSERT t2 VALUES (3,4,5); SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; a b 1 4 -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 178c3a8cb4f..a9048b65d51 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -1,5 +1,4 @@ drop table if exists t1; -drop table if exists t1; drop table t1; Unknown table 't1' create table t1(n int); @@ -13,6 +12,8 @@ select * from t1; n 1 drop database if exists mysqltest; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist create database mysqltest; drop database if exists mysqltest; create database mysqltest; @@ -25,6 +26,8 @@ drop database if exists mysqltest; create database mysqltest; drop database mysqltest; drop database if exists mysqltest; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist flush tables with read lock; create database mysqltest; Got one of the listed errors diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index 7080f2b6145..4e7e4769f1b 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -1,6 +1,6 @@ -drop table if exists t1; +drop table if exists t1,t2; +drop database if exists mysqltest; create temporary table t1(n int not null primary key); -drop table if exists t2; create table t2(n int); insert into t2 values(3); select * from t1; @@ -11,7 +11,6 @@ drop table t2; Table 't2' was locked with a READ lock and can't be updated drop table t2; unlock tables; -drop database if exists mysqltest; create database mysqltest; create table mysqltest.t1(n int); insert into mysqltest.t1 values (23); diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index a991981bf21..1382c31d145 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -141,7 +141,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `ticket` int(11) default NULL, - `inhalt` text character set latin1, + `inhalt` text, KEY `tig` (`ticket`), FULLTEXT KEY `tix` (`inhalt`) ) TYPE=MyISAM CHARSET=latin1 @@ -206,7 +206,6 @@ select 8 from t1; 8 8 drop table t1; -drop table if exists t1; create table t1 (a text, fulltext key (a)); insert into t1 values ('aaaa'); repair table t1; diff --git a/mysql-test/r/fulltext_multi.result b/mysql-test/r/fulltext_multi.result index 72b7102fd3f..968b00020e2 100644 --- a/mysql-test/r/fulltext_multi.result +++ b/mysql-test/r/fulltext_multi.result @@ -1,4 +1,3 @@ -use test; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a int(11) NOT NULL auto_increment, diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result index c0e72ff789f..bfee9eba280 100644 --- a/mysql-test/r/fulltext_order_by.result +++ b/mysql-test/r/fulltext_order_by.result @@ -1,4 +1,3 @@ -use test; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, diff --git a/mysql-test/r/func_crypt.result b/mysql-test/r/func_crypt.result index ad3a64ccd1d..461ae1e7e09 100644 --- a/mysql-test/r/func_crypt.result +++ b/mysql-test/r/func_crypt.result @@ -1,6 +1,15 @@ select length(encrypt('foo', 'ff')) <> 0; length(encrypt('foo', 'ff')) <> 0 1 -select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa'); +select password("a",""), password("a",NULL), password("","a"), password(NULL,"a"); +password("a","") password("a",NULL) password("","a") password(NULL,"a") +*2517f7235d68d4ba2e5019c93420523101157a792c01 NULL NULL +select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa"); +password("aaaaaaaaaaaaaaaa","a") password("a","aaaaaaaaaaaaaaaa") +*2cd3b9a44e9a9994789a30f935c92f45a96c5472f381 *37c7c5c794ff144819f2531bf03c57772cd84e40db09 +select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa'); old_password('test') length(password("1")) length(encrypt('test')) encrypt('test','aa') 378b243e220ca493 45 13 aaqPiZY5xR5l. +select old_password(""), old_password(NULL), password(""), password(NULL); +old_password("") old_password(NULL) password("") password(NULL) + NULL NULL diff --git a/mysql-test/r/func_equal.result b/mysql-test/r/func_equal.result index 32a911eedf8..352b76f2744 100644 --- a/mysql-test/r/func_equal.result +++ b/mysql-test/r/func_equal.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2; select 0<=>0,0.0<=>0.0,"A"<=>"A",NULL<=>NULL; 0<=>0 0.0<=>0.0 "A"<=>"A" NULL<=>NULL 1 1 1 1 @@ -10,7 +11,6 @@ select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0; select "A"<=>"B","A"<=>NULL,NULL<=>"A"; "A"<=>"B" "A"<=>NULL NULL<=>"A" 0 0 0 -drop table if exists t1,t2; create table t1 (id int, value int); create table t2 (id int, value int); insert into t1 values (1,null); diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 01d70c7c4c6..006dc8abef0 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 1 in (1,2,3); 1 in (1,2,3) 1 @@ -34,7 +35,6 @@ select 3.5 in (1.5,NULL,3.5); select 10.5 in (1.5,NULL,3.5); 10.5 in (1.5,NULL,3.5) NULL -drop table if exists t1; CREATE TABLE t1 (a int, b int, c int); insert into t1 values (1,2,3), (1,NULL,3); select 1 in (a,b,c) from t1; diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 5305c16c5d9..ab72e42eca9 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -25,3 +25,20 @@ find_in_set("","a,b,c") find_in_set("","a,b,c,") find_in_set("",",a,b,c") select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); find_in_set("abc","abc") find_in_set("ab","abc") find_in_set("abcd","abc") 1 0 0 +drop table if exists t1,t2; +create table t1 (id int(10) not null unique); +create table t2 (id int(10) not null primary key, +val int(10) not null); +insert into t1 values (1),(2),(4); +insert into t2 values (1,1),(2,1),(3,1),(4,2); +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; +id elt(two.val,'one','two') +1 one +2 one +4 two +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; +id elt(two.val,'one','two') +1 one +2 one +4 two +drop table t1,t2; diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index d0358aad6ba..b3468586f32 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -170,6 +170,9 @@ quote(concat('abc\'', '\\cba')) select quote(1/0), quote('\0\Z'); quote(1/0) quote('\0\Z') NULL '\0\Z' +select length(quote(concat(char(0),"test"))); +length(quote(concat(char(0),"test"))) +8 select reverse(""); reverse("") diff --git a/mysql-test/r/gcc296.result b/mysql-test/r/gcc296.result index 8f78f70cc1f..628bbbf3f93 100644 --- a/mysql-test/r/gcc296.result +++ b/mysql-test/r/gcc296.result @@ -1,5 +1,5 @@ -drop table if exists obory; -CREATE TABLE obory ( +drop table if exists t1; +CREATE TABLE t1 ( kodoboru varchar(10) default NULL, obor tinytext, aobor tinytext, @@ -7,14 +7,14 @@ UNIQUE INDEX kodoboru (kodoboru), FULLTEXT KEY obor (obor), FULLTEXT KEY aobor (aobor) ); -INSERT INTO obory VALUES ('0101000000','aaa','AAA'); -INSERT INTO obory VALUES ('0102000000','bbb','BBB'); -INSERT INTO obory VALUES ('0103000000','ccc','CCC'); -INSERT INTO obory VALUES ('0104000000','xxx','XXX'); -select * from obory; +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); +select * from t1; kodoboru obor aobor 0101000000 aaa AAA 0102000000 bbb BBB 0103000000 ccc CCC 0104000000 xxx XXX -drop table obory; +drop table t1; diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index 696d8200b70..aa3de48c09e 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -1,6 +1,6 @@ +drop table if exists t1,t2,t3; SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1); Invalid use of group function -drop table if exists t1,t2,t3; CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, @@ -42,7 +42,7 @@ SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1 userid MIN(t1.score+0.0) 1 1.0 2 2.0 -drop table test.t1,test.t2; +drop table t1,t2; CREATE TABLE t1 ( PID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, payDate date DEFAULT '0000-00-00' NOT NULL, @@ -390,7 +390,6 @@ CONCAT(a, b) count(*) abcdef 1 hijklm 2 DROP TABLE t1; -drop table if exists t1; create table t1 (One int unsigned, Two int unsigned, Three int unsigned, Four int unsigned); insert into t1 values (1,2,1,4),(1,2,2,4),(1,2,3,4),(1,2,4,4),(1,1,1,4),(1,1,2,4),(1,1,3,4),(1,1,4,4),(1,3,1,4),(1,3,2,4),(1,3,3,4),(1,3,4,4); select One, Two, sum(Four) from t1 group by One,Two; diff --git a/mysql-test/r/innodb-deadlock.result b/mysql-test/r/innodb-deadlock.result index db7155f14fb..e1b3e38b243 100644 --- a/mysql-test/r/innodb-deadlock.result +++ b/mysql-test/r/innodb-deadlock.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (id integer, x integer) type=INNODB; insert into t1 values(0, 0); set autocommit=0; @@ -18,7 +18,6 @@ id x 0 2 commit; drop table t1; -drop table if exists t1, t2; create table t1 (id integer, x integer) type=INNODB; create table t2 (b integer, a integer) type=INNODB; insert into t1 values(0, 0), (300, 300); diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 82e678416ad..f5bbf082730 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -805,7 +805,7 @@ create table t1 (a char(20), index (a(5))) type=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` char(20) character set latin1 default NULL, + `a` char(20) default NULL, KEY `a` (`a`) ) TYPE=InnoDB CHARSET=latin1 drop table t1; @@ -918,8 +918,8 @@ id select_type table type possible_keys key key_len ref rows Extra drop table t1; create table t1 (t int not null default 1, key (t)) type=innodb; desc t1; -Field Type Null Key Default Extra -t int(11) MUL 1 +Field Type Collation Null Key Default Extra +t int(11) binary MUL 1 drop table t1; CREATE TABLE t1 ( number bigint(20) NOT NULL default '0', @@ -1021,7 +1021,6 @@ id code name 7 4 Matt COMMIT; DROP TABLE t1; -drop table if exists t1,t2; create table t1 (n int(10), d int(10)) type=innodb; create table t2 (n int(10), d int(10)) type=innodb; insert into t1 values(1,1),(1,2); diff --git a/mysql-test/r/innodb_cache.result b/mysql-test/r/innodb_cache.result index 47abcb45fe5..7d351a13e16 100644 --- a/mysql-test/r/innodb_cache.result +++ b/mysql-test/r/innodb_cache.result @@ -1,4 +1,4 @@ -drop table if exists t1, t2, t3; +drop table if exists t1,t2,t3; flush status; set autocommit=0; create table t1 (a int not null) type=innodb; diff --git a/mysql-test/r/innodb_handler.result b/mysql-test/r/innodb_handler.result index a55114a0e3d..dc6a265fb29 100644 --- a/mysql-test/r/innodb_handler.result +++ b/mysql-test/r/innodb_handler.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 2ffa9d88618..ebd34dd7668 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -48,10 +48,19 @@ sid id skr 1 skr 2 test 1 +insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); +select * from t1; +sid id +rts 1 +rts 2 +skr 1 +skr 2 +test 1 +test 2 drop table t1; -drop database if exists foo; -create database foo; -use foo; +drop database if exists test_$1; +create database test_$1; +use test_$1; create table t1 (c int); -insert into foo.t1 set foo.t1.c = '1'; -drop database foo; +insert into test_$1.t1 set test_$1.t1.c = '1'; +drop database test_$1; diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index e24c3179a0c..9a65eaee573 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -21,8 +21,7 @@ payoutID 20 22 drop table t1,t2; -DROP TABLE IF EXISTS crash1,crash2; -CREATE TABLE `crash1` ( +CREATE TABLE `t1` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -37,7 +36,7 @@ KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -CREATE TABLE `crash2` ( +CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -52,17 +51,17 @@ KEY `date` (`date`), KEY `pseudo` (`pseudo`), KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -INSERT INTO crash2 +INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' ,3649052399,0); -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; show variables like '%bulk%'; Variable_name Value bulk_insert_buffer_size 8388608 -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS crash1,crash2; +DROP TABLE IF EXISTS t1,t2; diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result index e8f7898f1eb..7871e899773 100644 --- a/mysql-test/r/isam.result +++ b/mysql-test/r/isam.result @@ -38,6 +38,8 @@ Incorrect table definition; There can only be one auto column and it must be def create table t1 (ordid int(8), unique (ordid)) type=isam; Column 'ordid' is used with UNIQUE or INDEX but is not defined as NOT NULL drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); create table t2 type=isam select * from t1; @@ -62,15 +64,15 @@ Table Op Msg_type Msg_text test.t2 check error Table 't2' was not locked with LOCK TABLES test.t1 check status OK show columns from t1; -Field Type Null Key Default Extra -a int(11) PRI 0 -b int(11) MUL 0 -c int(11) 0 +Field Type Collation Null Key Default Extra +a int(11) binary PRI 0 +b int(11) binary MUL 0 +c int(11) binary 0 show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -a int(11) PRI 0 select,insert,update,references -b int(11) MUL 0 select,insert,update,references -c int(11) 0 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +a int(11) binary PRI 0 select,insert,update,references +b int(11) binary MUL 0 select,insert,update,references +c int(11) binary 0 select,insert,update,references show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 4 NULL NULL BTREE diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index b89a6696727..8abe6d517ee 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -181,7 +181,6 @@ SELECT t1.usr_id,t1.uniq_id,t1.increment,t2.usr2_id,t2.c_amount,t2.max FROM t1 L usr_id uniq_id increment usr2_id c_amount max 3 4 84676 NULL NULL NULL drop table t1,t2; -drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( cod_asig int(11) DEFAULT '0' NOT NULL, desc_larga_cat varchar(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index 1cd9c9dfe79..9e1f743d132 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -147,7 +147,6 @@ t1 0 e 1 e A 0 NULL NULL BTREE t1 0 b 1 b A NULL NULL NULL YES BTREE t1 1 c 1 c A NULL NULL NULL YES BTREE drop table t1; -DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index d0e595d6551..9199f291c08 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -172,7 +172,7 @@ show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `a` int(11) NOT NULL default '0', - `b` char(20) character set latin1 default NULL, + `b` char(20) default NULL, KEY `a` (`a`) ) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2) create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2); @@ -181,6 +181,8 @@ Can't open file: 't4.MRG'. (errno: 143) create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2); Incorrect table definition; All MERGE tables must be in the same database drop table if exists t5,t4,t3,t1,t2; +Warnings: +Note 1051 Unknown table 't5' create table t1 (c char(10)) type=myisam; create table t2 (c char(10)) type=myisam; create table t3 (c char(10)) union=(t1,t2) type=merge; @@ -262,7 +264,6 @@ create table t1 (a int not null) type=merge; select * from t1; a drop table t1; -drop table if exists t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); @@ -274,7 +275,6 @@ a b 1 1 1 2 drop table t3,t1,t2; -drop table if exists t6, t5, t4, t3, t2, t1; create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) UNION=(t1,t2) INSERT_METHOD=NO; @@ -533,15 +533,14 @@ CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default ' INSERT INTO t1 VALUES (1,1), (2,1); CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); -select max(b) from t where a = 2; +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +select max(b) from t3 where a = 2; max(b) NULL select max(b) from t1 where a = 2; max(b) 1 -drop table if exists t,t1,t2; -drop table if exists t1, t2, t3, t4, t5, t6; +drop table if exists t3,t1,t2; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -561,7 +560,6 @@ a 1 2 drop table if exists t6, t3, t1, t2, t4, t5; -DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( fileset_id tinyint(3) unsigned NOT NULL default '0', file_code varchar(32) NOT NULL default '', @@ -595,4 +593,4 @@ EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 const PRIMARY,files PRIMARY 33 const,const 1 -DROP TABLE IF EXISTS t2, t1; +DROP TABLE t2, t1; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 8cf035343b1..4dbb3c8adb1 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -96,7 +96,7 @@ id mydate 5 2002-05-12 00:00:00 6 2002-06-22 00:00:00 7 2002-07-22 00:00:00 -DROP TABLE IF EXISTS t1,t2,t3; +DROP TABLE t1,t2,t3; CREATE TABLE IF NOT EXISTS `t1` ( `id` int(11) NOT NULL auto_increment, `tst` text, @@ -125,7 +125,7 @@ ID ParId tst tst1 1 1 MySQL MySQL AB 2 2 MSSQL Microsoft 3 3 ORACLE ORACLE -drop table if exists t1, t2 ; +drop table t1, t2 ; create table t1 (n numeric(10)); create table t2 (n numeric(10)); insert into t2 values (1),(2),(4),(8),(16),(32); @@ -235,4 +235,28 @@ select * from t2; n d 1 30 1 30 +UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n; +select * from t1; +n d +1 30 +3 2 +select * from t2; +n d +1 30 +1 30 +DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; +select * from t1; +n d +3 2 +select * from t2; +n d drop table t1,t2; +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); +update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; +update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; +drop table t1,t2,t3; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 6b9c3a53305..23610be36c4 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) @@ -83,7 +83,6 @@ OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK DROP TABLE t1; -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); @@ -121,7 +120,6 @@ check table t1; Table Op Msg_type Msg_text test.t1 check status OK drop table t1; -drop table if exists t1; create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, @@ -286,7 +284,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -drop table if exists t1; +drop table t1; CREATE TABLE `t1` ( `post_id` mediumint(8) unsigned NOT NULL auto_increment, `topic_id` mediumint(8) unsigned NOT NULL default '0', @@ -318,3 +316,51 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255)); ALTER TABLE t1 ADD INDEX t1 (a, b, c); Specified key was too long. Max key length is 500 DROP TABLE t1; +CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); +INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4); +create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); +INSERT into t2 values (1,1,1), (2,2,2); +optimize table t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +show index from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 1 b 1 b A 5 NULL NULL YES BTREE +t1 1 c 1 c A 5 NULL NULL YES BTREE +t1 1 a 1 a A 1 NULL NULL BTREE +t1 1 a 2 b A 5 NULL NULL YES BTREE +t1 1 c_2 1 c A 5 NULL NULL YES BTREE +t1 1 c_2 2 a A 5 NULL NULL BTREE +explain select * from t1,t2 where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 +1 SIMPLE t2 ALL a NULL NULL NULL 2 Using where +explain select * from t1,t2 force index(a) where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where +explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ref a a 4 t2.a 3 +explain select * from t1,t2 where t1.b=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL b NULL NULL NULL 2 +1 SIMPLE t1 ref b b 5 t2.b 1 Using where +explain select * from t1,t2 force index(c) where t1.a=t2.a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where +explain select * from t1 where a=0 or a=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where +explain select * from t1 force index (a) where a=0 or a=2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range a a 4 NULL 4 Using where +explain select * from t1 where c=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref c,c_2 c 5 const 1 Using where +explain select * from t1 use index() where c=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +drop table t1,t2; diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index cdea66cbf58..91af34b6681 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1,3 +1,4 @@ +drop table if exists t1; select null,\N,isnull(null),isnull(1/0),isnull(1/0 = null),ifnull(null,1),ifnull(null,"TRUE"),ifnull("TRUE","ERROR"),1/0 is null,1 is not null; NULL NULL isnull(null) isnull(1/0) isnull(1/0 = null) ifnull(null,1) ifnull(null,"TRUE") ifnull("TRUE","ERROR") 1/0 is null 1 is not null NULL NULL 1 1 1 1 TRUE TRUE 1 1 @@ -34,7 +35,6 @@ NULL AND 0 0 and NULL select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); inet_ntoa(null) inet_aton(null) inet_aton("122.256") inet_aton("122.226.") inet_aton("") NULL NULL NULL NULL NULL -drop table if exists t1; create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 484437959a0..ce3af6c37cd 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; @@ -136,7 +136,6 @@ select * from t1 where b like "6%"; a b c 6 6 0 drop table t1; -DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result index 30366762cd0..c0b2ada0053 100644 --- a/mysql-test/r/odbc.result +++ b/mysql-test/r/odbc.result @@ -1,7 +1,7 @@ +drop table if exists t1; select {fn length("hello")}, { date "1997-10-20" }; {fn length("hello")} 1997-10-20 5 1997-10-20 -drop table if exists t1; create table t1 (a int not null auto_increment,b int not null,primary key (a,b)); insert into t1 SET A=NULL,B=1; insert into t1 SET a=null,b=2; diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index 52bd83df5ed..428d1052d19 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -1,6 +1,6 @@ -drop table if exists sales; -create table sales ( product varchar(32), country varchar(32), year int, profit int); -insert into sales values ( 'Computer', 'India',2000, 1200), +drop table if exists t1; +create table t1 ( product varchar(32), country varchar(32), year int, profit int); +insert into t1 values ( 'Computer', 'India',2000, 1200), ( 'TV', 'United States', 1999, 150), ( 'Calculator', 'United States', 1999,50), ( 'Computer', 'United States', 1999,1500), @@ -14,14 +14,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'India', 1999,1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); -select product, country , year, sum(profit) from sales group by product, country, year with cube; +select product, country , year, sum(profit) from t1 group by product, country, year with cube; This version of MySQL doesn't yet support 'CUBE' -explain select product, country , year, sum(profit) from sales group by product, country, year with cube; +explain select product, country , year, sum(profit) from t1 group by product, country, year with cube; This version of MySQL doesn't yet support 'CUBE' -select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'ROLLUP' -explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; +explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'ROLLUP' -select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup; This version of MySQL doesn't yet support 'CUBE' -drop table sales; +drop table t1; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5645961a178..9bacae92945 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -222,7 +222,6 @@ DateOfAction TransactionID 1999-07-27 834 1999-07-27 840 drop table t1,t2,t3; -drop table if exists t1; CREATE TABLE t1 ( member_id int(11) NOT NULL auto_increment, inschrijf_datum varchar(20) NOT NULL default '', @@ -506,3 +505,37 @@ SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,des titre numeropost auteur icone nbrep 0 date vue ouvert lastauteur dest test 1 joce 0 0 0 0000-00-00 00:00:00 0 1 bug drop table t1,t2; +CREATE TABLE t1 ( +FieldKey varchar(36) NOT NULL default '', +LongVal bigint(20) default NULL, +StringVal mediumtext, +KEY FieldKey (FieldKey), +KEY LongField (FieldKey,LongVal), +KEY StringField (FieldKey,StringVal(32)) +); +INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); +EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref FieldKey,LongField,StringField LongField 36 const 2 Using where +SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +FieldKey LongVal StringVal +1 0 2 +1 1 3 +1 2 1 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range FieldKey,LongField,StringField FieldKey 36 NULL 4 Using where; Using filesort +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +FieldKey LongVal StringVal +3 1 2 +3 2 1 +3 3 3 +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range FieldKey,LongField,StringField LongField 36 NULL 4 Using where +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +FieldKey LongVal StringVal +3 1 2 +3 2 1 +3 3 3 +DROP TABLE t1; diff --git a/mysql-test/r/packet.result b/mysql-test/r/packet.result new file mode 100644 index 00000000000..e994e4d63da --- /dev/null +++ b/mysql-test/r/packet.result @@ -0,0 +1,25 @@ +set global max_allowed_packet=100; +set max_allowed_packet=100; +set global net_buffer_length=100; +set net_buffer_length=100; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +len +1024 +select repeat('a',200); +repeat('a',200) +NULL +select @@net_buffer_length, @@max_allowed_packet; +@@net_buffer_length @@max_allowed_packet +1024 80 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +Got a packet bigger than 'max_allowed_packet' +set global max_allowed_packet=default; +set max_allowed_packet=default; +set global net_buffer_length=default; +set net_buffer_length=default; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +len +100 +select length(repeat('a',200)); +length(repeat('a',200)) +200 diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index a37313a150a..17c9c8edbd2 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -2,6 +2,7 @@ flush query cache; flush query cache; reset query cache; flush status; +drop database if exists mysqltest; drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; create table t1 (a int not null); insert into t1 values (1),(2),(3); @@ -531,6 +532,7 @@ i show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 2 +update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; use mysql; select * from db; diff --git a/mysql-test/r/rename.result b/mysql-test/r/rename.result index b2bb659502a..e422fbe49c1 100644 --- a/mysql-test/r/rename.result +++ b/mysql-test/r/rename.result @@ -37,3 +37,5 @@ select * from t3; 3 table 3 3 table 3 drop table if exists t1,t2,t3,t4; +Warnings: +Note 1051 Unknown table 't4' diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 1d606fc370c..f3522e05380 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -1,3 +1,4 @@ +drop table if exists t1; select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)) 1 @@ -88,7 +89,6 @@ ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)) NULL SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); Cardinality error (more/less than 2 columns) -drop table if exists t1; create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -127,7 +127,6 @@ ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) drop table t1; select ROW(1,1); Cardinality error (more/less than 1 columns) -drop table if exists t1; create table t1 (i int); select 1 from t1 where ROW(1,1); Cardinality error (more/less than 1 columns) diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result index 5cee2e6deff..dd569944f0e 100644 --- a/mysql-test/r/rpl000001.result +++ b/mysql-test/r/rpl000001.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1,t2,t3; create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1; diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result index 819f43da103..56e34b4874f 100644 --- a/mysql-test/r/rpl000002.result +++ b/mysql-test/r/rpl000002.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -18,7 +17,6 @@ Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 9999 2 1 drop table t1; stop slave; -drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; insert into t2 set created=now(); diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result deleted file mode 100644 index 7c63ada9cdf..00000000000 --- a/mysql-test/r/rpl000003.result +++ /dev/null @@ -1,17 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -drop table if exists t1; -create table t1(n int primary key); -insert into t1 values (1),(2),(2); -Duplicate entry '2' for key 1 -insert into t1 values (3); -select * from t1; -n -1 -2 -3 -drop table t1; diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result index a677eac36d4..067696345e4 100644 --- a/mysql-test/r/rpl000004.result +++ b/mysql-test/r/rpl000004.result @@ -5,18 +5,13 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0; -drop table if exists t1; create table t1 (word char(20) not null, index(word)); load data infile '../../std_data/words.dat' into table t1; -drop table if exists t2; create table t2 (word char(20) not null); load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key); -drop table if exists t1; load table t1 from master; -drop table if exists t2; load table t2 from master; -drop table if exists t3; load table t3 from master; check table t1; Table Op Msg_type Msg_text diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result index 228bb00a1a3..0202e43dcb2 100644 --- a/mysql-test/r/rpl000005.result +++ b/mysql-test/r/rpl000005.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result index e256e0f0136..7209ec3c3d1 100644 --- a/mysql-test/r/rpl000006.result +++ b/mysql-test/r/rpl000006.result @@ -5,13 +5,11 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; set SQL_LOG_BIN=0,timestamp=200006; -drop table if exists t1; create table t1(t timestamp not null,a char(1)); insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; unix_timestamp(t) 200006 -drop table if exists t1; load table t1 from master; select unix_timestamp(t) from t1; unix_timestamp(t) diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result index eb0089da9d6..a88a3c690ed 100644 --- a/mysql-test/r/rpl000008.result +++ b/mysql-test/r/rpl000008.result @@ -5,21 +5,19 @@ reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); +drop table if exists mysqltest_foo; +drop table if exists mysqltest_bar; +create table mysqltest_foo (n int); +insert into mysqltest_foo values(4); use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(5); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -drop table if exists choo; -create table choo (k int); -insert into choo values(55); -select foo.n,bar.m,choo.k from foo,bar,choo; +create table mysqltest_foo (n int); +insert into mysqltest_foo values(5); +create table mysqltest_bar (m int); +insert into mysqltest_bar values(15); +create table t1 (k int); +insert into t1 values(55); +select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; n m k 4 15 55 -drop table if exists foo,bar,choo; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; +drop table mysqltest_foo,mysqltest_bar,t1; diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result index 1a1ea309ae9..e67993b53f6 100644 --- a/mysql-test/r/rpl000009.result +++ b/mysql-test/r/rpl000009.result @@ -4,80 +4,78 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists foo; -create database foo; -drop database if exists bar; -create database bar; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(4); -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(5); -drop table if exists bar.bar; -create table bar.bar (m int); -insert into bar.bar values(15); -select foo.foo.n,bar.bar.m from foo.foo,bar.bar; +drop database if exists mysqltest2; +create database mysqltest2; +drop database if exists mysqltest; +create database mysqltest; +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(4); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(5); +create table mysqltest.bar (m int); +insert into mysqltest.bar values(15); +select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; n m 4 15 -drop database if exists bar; -drop database if exists foo; -drop database if exists bar; -drop database if exists foo; +drop database mysqltest; +drop database mysqltest2; set sql_log_bin = 0; -create database foo; -create database bar; +create database mysqltest2; +create database mysqltest; show databases; Database -bar -foo mysql +mysqltest +mysqltest2 test -create table foo.t1(n int, s char(20)); -create table foo.t2(n int, s text); -insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three'); -insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table bar.t1(n int, s char(20)); -create table bar.t2(n int, s text); -insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar'); -insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'), -(13, 'thirteen bar'); +create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t2(n int, s text); +insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); +insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); +create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t2(n int, s text); +insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); +insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), +(13, 'thirteen test'); set sql_log_bin = 1; show databases; Database mysql test load data from master; +Warnings: +Note 1008 Can't drop database 'mysqltest'. Database doesn't exist +Note 1008 Can't drop database 'mysqltest2'. Database doesn't exist show databases; Database -bar -foo mysql +mysqltest +mysqltest2 test -use foo; +use mysqltest2; show tables; -Tables_in_foo -use bar; +Tables_in_mysqltest2 +use mysqltest; show tables; -Tables_in_bar +Tables_in_mysqltest t1 t2 -select * from bar.t1; +select * from mysqltest.t1; n s -1 one bar -2 two bar -3 three bar -select * from bar.t2; +1 one test +2 two test +3 three test +select * from mysqltest.t2; n s -11 eleven bar -12 twelve bar -13 thirteen bar -insert into bar.t1 values (4, 'four bar'); -select * from bar.t1; +11 eleven test +12 twelve test +13 thirteen test +insert into mysqltest.t1 values (4, 'four test'); +select * from mysqltest.t1; n s -1 one bar -2 two bar -3 three bar -4 four bar -drop database bar; -drop database foo; +1 one test +2 two test +3 three test +4 four test +drop database mysqltest; +drop database mysqltest2; diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result index 6b6b89d1547..65191ea411f 100644 --- a/mysql-test/r/rpl000010.result +++ b/mysql-test/r/rpl000010.result @@ -4,8 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; -drop table if exists t1; create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result index bb017076822..dd0fa2fbe74 100644 --- a/mysql-test/r/rpl000011.result +++ b/mysql-test/r/rpl000011.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int); insert into t1 values(1); stop slave; diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result index f809fa7fe74..17fb53010ab 100644 --- a/mysql-test/r/rpl000012.result +++ b/mysql-test/r/rpl000012.result @@ -4,18 +4,16 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; -drop table if exists test.t3; -create temporary table test.t3 (n int not null); -alter table test.t3 add primary key(n); +create temporary table t3 (n int not null); +alter table t3 add primary key(n); flush logs; insert into t3 values (100); insert into t2 select * from t3; -drop table if exists test.t3; +drop table if exists t3; insert into t2 values (101); create temporary table t1 (n int); insert into t1 values (4),(5); @@ -35,3 +33,5 @@ show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result index 333d769baff..37838bb88e0 100644 --- a/mysql-test/r/rpl000013.result +++ b/mysql-test/r/rpl000013.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t2; create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -25,3 +24,5 @@ show status like 'Slave_open_temp_tables'; Variable_name Value Slave_open_temp_tables 0 drop table if exists t1,t2; +Warnings: +Note 1051 Unknown table 't1' diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result index 0b947c0bb70..e7abc3b3b48 100644 --- a/mysql-test/r/rpl_alter.result +++ b/mysql-test/r/rpl_alter.result @@ -4,18 +4,18 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop database if exists d1; -create database d1; -create table d1.t1 ( n int); -alter table d1.t1 add m int; -insert into d1.t1 values (1,2); -create table d1.t2 (n int); -insert into d1.t2 values (45); -rename table d1.t2 to d1.t3, d1.t1 to d1.t2; -select * from d1.t2; +drop database if exists test_$1; +create database test_$1; +create table test_$1.t1 ( n int); +alter table test_$1.t1 add m int; +insert into test_$1.t1 values (1,2); +create table test_$1.t2 (n int); +insert into test_$1.t2 values (45); +rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; +select * from test_$1.t2; n m 1 2 -select * from d1.t3; +select * from test_$1.t3; n 45 -drop database d1; +drop database test_$1; diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result index 267806feb2e..8818029ab99 100644 --- a/mysql-test/r/rpl_empty_master_crash.result +++ b/mysql-test/r/rpl_empty_master_crash.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space load table t1 from master; diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result index d122b13adc2..956555f9318 100644 --- a/mysql-test/r/rpl_failsafe.result +++ b/mysql-test/r/rpl_failsafe.result @@ -1,4 +1,5 @@ stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index b4dc132e046..fa38e42ae73 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -10,7 +10,9 @@ master-bin.000001 79 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127 +stop slave; change master to master_log_pos=73; +start slave; stop slave; change master to master_log_pos=73; show slave status; @@ -20,6 +22,7 @@ start slave; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space 127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4 +stop slave; change master to master_log_pos=173; start slave; show slave status; @@ -32,6 +35,7 @@ create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); +stop slave; change master to master_log_pos=79; start slave; select * from t1; diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result index 66c94a00b5f..3807479fb54 100644 --- a/mysql-test/r/rpl_redirect.result +++ b/mysql-test/r/rpl_redirect.result @@ -9,7 +9,6 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo SHOW SLAVE HOSTS; Server_id Host Port Rpl_recovery_rank Master_id 2 127.0.0.1 SLAVE_PORT 2 1 -drop table if exists t1; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); insert into t1 values(5); diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index aabda54640c..9ae292c2709 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -25,4 +25,4 @@ n 4 select * from t11; Table 'test.t11' doesn't exist -drop table if exists t1,t2,t3,t11; +drop table if exists t1,t2,t11; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 2582b875daa..5275ef26b5c 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -22,7 +22,6 @@ s Could not break slave Tried hard flush logs; -drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; @@ -58,7 +57,6 @@ m 1234 create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); -drop table if exists t3; create table t3 (n int); create table t4 select * from temp_table; show binary logs; diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result index 91aae09001f..e52426c381c 100644 --- a/mysql-test/r/rpl_skip_error.result +++ b/mysql-test/r/rpl_skip_error.result @@ -4,7 +4,6 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -drop table if exists t1; create table t1 (n int not null primary key); insert into t1 values (1); insert into t1 values (1); diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result new file mode 100644 index 00000000000..470a6302a2b --- /dev/null +++ b/mysql-test/r/rpl_temporary.result @@ -0,0 +1,73 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +drop table if exists t1,t2; +create table t1(f int); +create table t2(f int); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +create temporary table t3(f int); +insert into t3 select * from t1 where f<6; +create temporary table t3(f int); +insert into t2 select count(*) from t3; +insert into t3 select * from t1 where f>=4; +drop temporary table t3; +insert into t2 select count(*) from t3; +drop temporary table t3; +select * from t2; +f +5 +7 +show binlog events; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 4 Start 1 4 Server ver: 4.1.0-alpha-debug-log, Binlog ver: 3 +master-bin.000001 79 Query 1 79 use `test`; create table t1(f int) +master-bin.000001 136 Query 1 136 use `test`; create table t2(f int) +master-bin.000001 193 Query 1 193 use `test`; insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10) +master-bin.000001 290 Query 1 290 use `test`; create temporary table t3(f int) +master-bin.000001 357 Query 1 357 use `test`; insert into t3 select * from t1 where f<6 +master-bin.000001 433 Query 1 433 use `test`; create temporary table t3(f int) +master-bin.000001 500 Query 1 500 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 573 Query 1 573 use `test`; insert into t3 select * from t1 where f>=4 +master-bin.000001 650 Query 1 650 use `test`; drop temporary table t3 +master-bin.000001 708 Query 1 708 use `test`; insert into t2 select count(*) from t3 +master-bin.000001 781 Query 1 781 use `test`; drop temporary table t3 +drop table t1, t2; +use test; +SET TIMESTAMP=1040323920; +create table t1(f int); +SET TIMESTAMP=1040323931; +create table t2(f int); +SET TIMESTAMP=1040323938; +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +SET TIMESTAMP=1040323945; +SET @@session.pseudo_thread_id=1; +create temporary table t3(f int); +SET TIMESTAMP=1040323952; +SET @@session.pseudo_thread_id=1; +insert into t3 select * from t1 where f<6; +SET TIMESTAMP=1040324145; +SET @@session.pseudo_thread_id=2; +create temporary table t3(f int); +SET TIMESTAMP=1040324186; +SET @@session.pseudo_thread_id=1; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324200; +SET @@session.pseudo_thread_id=2; +insert into t3 select * from t1 where f>=4; +SET TIMESTAMP=1040324211; +SET @@session.pseudo_thread_id=1; +drop temporary table t3; +SET TIMESTAMP=1040324219; +SET @@session.pseudo_thread_id=2; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324224; +SET @@session.pseudo_thread_id=2; +drop temporary table t3; +select * from t2; +f +5 +7 +drop table t1,t2; diff --git a/mysql-test/r/sel000001.result b/mysql-test/r/sel000001.result deleted file mode 100644 index 28f6d3d1d5a..00000000000 --- a/mysql-test/r/sel000001.result +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT); -INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77); -SELECT s, id FROM t1 WHERE s = 'mouse'; -s id -mouse 3 -drop table t1; diff --git a/mysql-test/r/sel000002.result b/mysql-test/r/sel000002.result deleted file mode 100644 index b824de8de4a..00000000000 --- a/mysql-test/r/sel000002.result +++ /dev/null @@ -1,9 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (n INT); -INSERT INTO t1 VALUES (1), (2), (3); -SELECT * FROM t1; -n -1 -2 -3 -drop table t1; diff --git a/mysql-test/r/sel000003.result b/mysql-test/r/sel000003.result deleted file mode 100644 index c3853832f87..00000000000 --- a/mysql-test/r/sel000003.result +++ /dev/null @@ -1,8 +0,0 @@ -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score)); -INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10); -SELECT COUNT(*) as n, score FROM t1 GROUP BY score; -n score -4 10 -2 20 -drop table t1; diff --git a/mysql-test/r/sel000031.result b/mysql-test/r/sel000031.result deleted file mode 100644 index d3f01ab687f..00000000000 --- a/mysql-test/r/sel000031.result +++ /dev/null @@ -1,12 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; -id elt(two.val,'one','two') -1 one -2 one -4 two -drop table t1,t2; diff --git a/mysql-test/r/sel000032.result b/mysql-test/r/sel000032.result deleted file mode 100644 index 4cca245d75b..00000000000 --- a/mysql-test/r/sel000032.result +++ /dev/null @@ -1,12 +0,0 @@ -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; -id elt(two.val,'one','two') -1 one -2 one -4 two -drop table t1,t2; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 80aa6046e8d..9ed54f7c253 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1,4 +1,3 @@ -use test; drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -2493,7 +2492,6 @@ fld1 fld3 period price price2 018601 vacuuming 1001 5987435 234724 018801 inch 1001 5987435 234724 018811 repetitions 1001 5987435 234724 -drop table if exists company; create table t4 ( companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', @@ -3219,23 +3217,23 @@ Tables_in_test (s%) show tables from test like "t?"; Tables_in_test (t?) show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto int(11) PRI NULL auto_increment select,insert,update,references -fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references -companynr tinyint(2) unsigned zerofill 00 select,insert,update,references -fld3 char(30) character set latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 select,insert,update,references -fld5 char(35) character set latin1 select,insert,update,references -fld6 char(4) character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(11) binary PRI NULL auto_increment select,insert,update,references +fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references +companynr tinyint(2) unsigned zerofill binary 00 select,insert,update,references +fld3 char(30) latin1 MUL select,insert,update,references +fld4 char(35) latin1 select,insert,update,references +fld5 char(35) latin1 select,insert,update,references +fld6 char(4) latin1 select,insert,update,references show full columns from t2 from test like 'f%'; -Field Type Null Key Default Extra Privileges Comment -fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references -fld3 char(30) character set latin1 MUL select,insert,update,references -fld4 char(35) character set latin1 select,insert,update,references -fld5 char(35) character set latin1 select,insert,update,references -fld6 char(4) character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +fld1 int(6) unsigned zerofill binary UNI 000000 select,insert,update,references +fld3 char(30) latin1 MUL select,insert,update,references +fld4 char(35) latin1 select,insert,update,references +fld5 char(35) latin1 select,insert,update,references +fld6 char(4) latin1 select,insert,update,references show full columns from t2 from test like 's%'; -Field Type Null Key Default Extra Privileges Comment +Field Type Collation Null Key Default Extra Privileges Comment show keys from t2; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE @@ -3478,7 +3476,6 @@ a a a 2 2 2 3 3 3 drop table t1; -drop table if exists t1,t2; CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; @@ -3490,4 +3487,4 @@ aa id t2_id id 4 8302 2519 2519 5 8303 2520 2520 6 8304 2521 2521 -drop table if exists t1,t2; +drop table t1,t2; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 2e8d7d19465..d2bdc4f9401 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -93,15 +93,15 @@ c int not null comment 'int column' show create table t1 ; Table Create Table t1 CREATE TABLE `t1` ( - `test_set` set('val1','val2','val3') character set latin1 NOT NULL default '', - `name` char(20) character set latin1 default 'O''Brien' COMMENT 'O''Brien as default', + `test_set` set('val1','val2','val3') NOT NULL default '', + `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `c` int(11) NOT NULL default '0' COMMENT 'int column' ) TYPE=MyISAM CHARSET=latin1 COMMENT='it''s a table' show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -test_set set('val1','val2','val3') character set latin1 select,insert,update,references -name char(20) character set latin1 YES O'Brien select,insert,update,references O'Brien as default -c int(11) 0 select,insert,update,references int column +Field Type Collation Null Key Default Extra Privileges Comment +test_set set('val1','val2','val3') latin1 select,insert,update,references +name char(20) latin1 YES O'Brien select,insert,update,references O'Brien as default +c int(11) binary 0 select,insert,update,references int column drop table t1; create table t1 (a int not null, unique aa (a)); show create table t1; @@ -133,7 +133,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` char(10) character set latin1 default NULL, + `b` char(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0; @@ -141,7 +141,7 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` varchar(10) character set latin1 default NULL, + `b` varchar(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK_KEYS=DEFAULT DELAY_KEY_WRITE=0 ROW_FORMAT=default; @@ -149,40 +149,40 @@ show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) NOT NULL default '0', - `b` varchar(10) character set latin1 default NULL, + `b` varchar(10) default NULL, KEY `b` (`b`) ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a decimal(9,2), b decimal (9,0), e double(9,2), f double(5,0), h float(3,2), i float(3,0)); show columns from t1; -Field Type Null Key Default Extra -a decimal(9,2) YES NULL -b decimal(9,0) YES NULL -e double(9,2) YES NULL -f double(5,0) YES NULL -h float(3,2) YES NULL -i float(3,0) YES NULL +Field Type Collation Null Key Default Extra +a decimal(9,2) binary YES NULL +b decimal(9,0) binary YES NULL +e double(9,2) binary YES NULL +f double(5,0) binary YES NULL +h float(3,2) binary YES NULL +i float(3,0) binary YES NULL show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -a decimal(9,2) YES NULL select,insert,update,references -b decimal(9,0) YES NULL select,insert,update,references -e double(9,2) YES NULL select,insert,update,references -f double(5,0) YES NULL select,insert,update,references -h float(3,2) YES NULL select,insert,update,references -i float(3,0) YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +a decimal(9,2) binary YES NULL select,insert,update,references +b decimal(9,0) binary YES NULL select,insert,update,references +e double(9,2) binary YES NULL select,insert,update,references +f double(5,0) binary YES NULL select,insert,update,references +h float(3,2) binary YES NULL select,insert,update,references +i float(3,0) binary YES NULL select,insert,update,references drop table t1; create table t1 (c decimal, d double, f float, r real); show columns from t1; -Field Type Null Key Default Extra -c decimal(10,0) YES NULL -d double YES NULL -f float YES NULL -r double YES NULL +Field Type Collation Null Key Default Extra +c decimal(10,0) binary YES NULL +d double binary YES NULL +f float binary YES NULL +r double binary YES NULL drop table t1; create table t1 (c decimal(3,3), d double(3,3), f float(3,3)); show columns from t1; -Field Type Null Key Default Extra -c decimal(4,3) YES NULL -d double(4,3) YES NULL -f float(4,3) YES NULL +Field Type Collation Null Key Default Extra +c decimal(4,3) binary YES NULL +d double(4,3) binary YES NULL +f float(4,3) binary YES NULL drop table t1; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 493768ece4a..04bf0575db3 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -1,13 +1,33 @@ +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12; select (select 2); (select 2) 2 +explain select (select 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation SELECT (SELECT 1) UNION SELECT (SELECT 2); (SELECT 1) 1 2 +explain SELECT (SELECT 1) UNION SELECT (SELECT 2); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation +Note 1247 Select 4 was reduced during optimisation SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 +explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used +4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1247 Select 2 was reduced during optimisation SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; Reference 'a' not supported (forward reference in item list) SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b; @@ -32,7 +52,7 @@ a 1 SELECT 1 FROM (SELECT (SELECT a) b) c; Unknown column 'a' in 'field list' -SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); id 1 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); @@ -52,7 +72,54 @@ a SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; a 1 -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; +SELECT (SELECT 1,2,3) = ROW(1,2,3); +(SELECT 1,2,3) = ROW(1,2,3) +1 +SELECT (SELECT 1,2,3) = ROW(1,2,1); +(SELECT 1,2,3) = ROW(1,2,1) +0 +SELECT (SELECT 1,2,3) < ROW(1,2,1); +(SELECT 1,2,3) < ROW(1,2,1) +0 +SELECT (SELECT 1,2,3) > ROW(1,2,1); +(SELECT 1,2,3) > ROW(1,2,1) +1 +SELECT (SELECT 1,2,3) = ROW(1,2,NULL); +(SELECT 1,2,3) = ROW(1,2,NULL) +NULL +SELECT ROW(1,2,3) = (SELECT 1,2,3); +ROW(1,2,3) = (SELECT 1,2,3) +1 +SELECT ROW(1,2,3) = (SELECT 1,2,1); +ROW(1,2,3) = (SELECT 1,2,1) +0 +SELECT ROW(1,2,3) < (SELECT 1,2,1); +ROW(1,2,3) < (SELECT 1,2,1) +0 +SELECT ROW(1,2,3) > (SELECT 1,2,1); +ROW(1,2,3) > (SELECT 1,2,1) +1 +SELECT ROW(1,2,3) = (SELECT 1,2,NULL); +ROW(1,2,3) = (SELECT 1,2,NULL) +NULL +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); +(SELECT 1.5,2,'a') = ROW(1.5,2,'a') +1 +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); +(SELECT 1.5,2,'a') = ROW(1.5,2,'b') +0 +SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b'); +(SELECT 1.5,2,'a') = ROW('b',2,'b') +0 +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); +(SELECT 'b',2,'a') = ROW(1.5,2,'a') +0 +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); +(SELECT 1.5,2,'a') = ROW(1.5,'c','a') +0 +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); +(SELECT 1.5,'c','a') = ROW(1.5,2,'a') +0 create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -86,20 +153,20 @@ select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); a b 1 7 2 7 -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; a b 1 7 2 7 3 8 -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); a b 1 7 2 7 3 8 4 8 -explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where @@ -243,7 +310,6 @@ W 1 SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3); a b W a -drop table if exists t8; CREATE TABLE `t8` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', `email` varchar(60) character set latin1 NOT NULL default '', @@ -453,7 +519,6 @@ a b 0 10 1 11 drop table t1, t2; -drop table if exists t11, t12, t2; create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); @@ -559,7 +624,6 @@ x y drop table t1, t2, t3; SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); No tables used -drop table if exists t; CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t VALUES (1),(2); SELECT * FROM t WHERE id IN (SELECT 1); @@ -581,12 +645,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ref id id 5 const 1 Using where; Using index 3 SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: +Note 1247 Select 3 was reduced during optimisation Note 1247 Select 2 was reduced during optimisation EXPLAIN SELECT * FROM t WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t index NULL id 5 NULL 2 Using where; Using index 2 DEPENDENT SUBSELECT NULL NULL NULL NULL NULL NULL NULL No tables used -3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 3); id SELECT * FROM t WHERE id IN (SELECT 5 UNION SELECT 2); @@ -602,7 +667,7 @@ CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin INSERT INTO t1 values (1),(1); UPDATE t SET id=(SELECT * FROM t1); Subselect returns more than 1 record -drop table t; +drop table t, t1; create table t (a int); insert into t values (1),(2),(3); select 1 IN (SELECT * from t); @@ -704,4 +769,88 @@ NULL select 10.5 > ANY (SELECT * from t); 10.5 > ANY (SELECT * from t) 1 +explain select (select a+1) from t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 3 +Warnings: +Note 1247 Select 2 was reduced during optimisation +select (select a+1) from t; +(select a+1) +2.5 +NULL +4.5 +drop table t; +create table t (a float); +select 10.5 IN (SELECT * from t LIMIT 1); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' drop table t; +create table t1 (a int, b int, c varchar(10)); +create table t2 (a int); +insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); +insert into t2 values (1),(2),(NULL); +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a) +1 1 a +2 0 b +NULL NULL NULL +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a) +1 0 a +2 1 b +NULL NULL NULL +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; +a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a) +1 0 a +2 0 b +NULL NULL NULL +drop table t1,t2; +create table t1 (a int, b real, c varchar(10)); +insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t1); +ROW(1, 1, 'a') IN (select a,b,c from t1) +1 +select ROW(1, 2, 'a') IN (select a,b,c from t1); +ROW(1, 2, 'a') IN (select a,b,c from t1) +NULL +select ROW(1, 1, 'a') IN (select b,a,c from t1); +ROW(1, 1, 'a') IN (select b,a,c from t1) +1 +select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null); +ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null) +1 +select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null); +ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null) +0 +select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); +ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null) +1 +select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a') +1 +select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a') +NULL +select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); +ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a') +1 +select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); +This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' +drop table t1; +create table t1 (a int); +insert into t1 values (1); +do @a:=(SELECT a from t1); +select @a; +@a +1 +set @a:=2; +set @a:=(SELECT a from t1); +select @a; +@a +1 +drop table t1; +do (SELECT a from t1); +Table 'test.t1' doesn't exist +set @a:=(SELECT a from t1); +Table 'test.t1' doesn't exist diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 7c8d10cf0a6..5568e5b25d8 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -48,7 +48,6 @@ c d e 3 b 2 drop table t1; drop table t1; -drop table if exists t1; CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255)); INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1'); SELECT CONCAT_WS(pkCrash, strCrash) FROM t1; @@ -77,7 +76,6 @@ insert into t1 values (1),(1); alter table t1 add primary key (a); Duplicate entry '1' for key 1 drop table t1; -drop table if exists t1; CREATE TABLE t1 ( d datetime default NULL ) TYPE=MyISAM; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index ba8d4f770f6..ba8e01d6319 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -1,27 +1,27 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7; CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000)); show columns from t1; -Field Type Null Key Default Extra -a blob YES NULL -b text character set latin1 YES NULL -c blob YES NULL -d mediumtext character set latin1 YES NULL -e longtext character set latin1 YES NULL +Field Type Collation Null Key Default Extra +a blob binary YES NULL +b text latin1 YES NULL +c blob binary YES NULL +d mediumtext latin1 YES NULL +e longtext latin1 YES NULL CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000)); Warnings: Warning 1244 Converting column 'a' from CHAR to TEXT Warning 1244 Converting column 'b' from CHAR to BLOB Warning 1244 Converting column 'c' from CHAR to TEXT show columns from t2; -Field Type Null Key Default Extra -a text character set latin1 YES NULL -b mediumblob YES NULL -c longtext character set latin1 YES NULL +Field Type Collation Null Key Default Extra +a text latin1 YES NULL +b mediumblob binary YES NULL +c longtext latin1 YES NULL create table t3 (a long, b long byte); show create TABLE t3; Table Create Table t3 CREATE TABLE `t3` ( - `a` mediumtext character set latin1, + `a` mediumtext, `b` mediumblob ) TYPE=MyISAM CHARSET=latin1 drop table t1,t2,t3 @@ -69,18 +69,18 @@ insert into t1 values (NULL,NULL,NULL,NULL); update t1 set c="",b=null where c="1"; lock tables t1 READ; show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -t text character set latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 YES NULL select,insert,update,references -b blob YES NULL select,insert,update,references -d varchar(10) binary YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +t text latin1 YES NULL select,insert,update,references +c varchar(10) latin1 YES NULL select,insert,update,references +b blob binary YES NULL select,insert,update,references +d varchar(10) binary binary YES NULL select,insert,update,references lock tables t1 WRITE; show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -t text character set latin1 YES NULL select,insert,update,references -c varchar(10) character set latin1 YES NULL select,insert,update,references -b blob YES NULL select,insert,update,references -d varchar(10) binary YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +t text latin1 YES NULL select,insert,update,references +c varchar(10) latin1 YES NULL select,insert,update,references +b blob binary YES NULL select,insert,update,references +d varchar(10) binary binary YES NULL select,insert,update,references unlock tables; select t from t1 where t like "hello"; t diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index 214328eab47..cf6533eef67 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -1,3 +1,4 @@ +drop table if exists t1,t2; create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -7,7 +8,6 @@ select * from t1 where b = '2000-01-01'; a b c test 2000-01-01 2000-01-01 2000-01-01 00:00:00 drop table t1; -drop table if exists t1,t2; CREATE TABLE t1 (name char(6),cdate date); INSERT INTO t1 VALUES ('name1','1998-01-01'); INSERT INTO t1 VALUES ('name2','1998-01-01'); diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 51e11d259eb..c0f0be246c9 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1626,13 +1626,13 @@ create table t1 (a enum (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') character set latin1 NOT NULL default '' + `a` enum('','a','b') NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a enum (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` enum('','a','b') character set latin1 NOT NULL default 'b' + `a` enum('','a','b') NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index c6eca3abe8b..3914114d92c 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -1,3 +1,4 @@ +drop table if exists t1; SELECT 10,10.0,10.,.1e+2,100.0e-1; 10 10.0 10. .1e+2 100.0e-1 10 10.0 10 10 10 @@ -7,12 +8,11 @@ SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000; SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; 1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1 10 10 10 10 10 10 0.1 0.1 0.1 -drop table if exists t1; create table t1 (f1 float(24),f2 float(52)); show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -f1 float YES NULL select,insert,update,references -f2 double YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +f1 float binary YES NULL select,insert,update,references +f2 double binary YES NULL select,insert,update,references insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150); select * from t1; @@ -69,19 +69,19 @@ min(a) drop table t1; create table t1 (f float, f2 float(24), f3 float(6,2), d double, d2 float(53), d3 double(10,3), de decimal, de2 decimal(6), de3 decimal(5,2), n numeric, n2 numeric(8), n3 numeric(5,6)); show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -f float YES NULL select,insert,update,references -f2 float YES NULL select,insert,update,references -f3 float(6,2) YES NULL select,insert,update,references -d double YES NULL select,insert,update,references -d2 double YES NULL select,insert,update,references -d3 double(10,3) YES NULL select,insert,update,references -de decimal(10,0) YES NULL select,insert,update,references -de2 decimal(6,0) YES NULL select,insert,update,references -de3 decimal(5,2) YES NULL select,insert,update,references -n decimal(10,0) YES NULL select,insert,update,references -n2 decimal(8,0) YES NULL select,insert,update,references -n3 decimal(7,6) YES NULL select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +f float binary YES NULL select,insert,update,references +f2 float binary YES NULL select,insert,update,references +f3 float(6,2) binary YES NULL select,insert,update,references +d double binary YES NULL select,insert,update,references +d2 double binary YES NULL select,insert,update,references +d3 double(10,3) binary YES NULL select,insert,update,references +de decimal(10,0) binary YES NULL select,insert,update,references +de2 decimal(6,0) binary YES NULL select,insert,update,references +de3 decimal(5,2) binary YES NULL select,insert,update,references +n decimal(10,0) binary YES NULL select,insert,update,references +n2 decimal(8,0) binary YES NULL select,insert,update,references +n3 decimal(7,6) binary YES NULL select,insert,update,references drop table t1; create table t1 (a decimal(7,3) not null, key (a)); insert into t1 values ("0"),("-0.00"),("-0.01"),("-0.002"),("1"); diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index ea2863aefce..19f1ac2b4d7 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -38,31 +38,31 @@ KEY (ulonglong,ulong), KEY (options,flags) ); show full fields from t1; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned PRI NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 YES hello select,insert,update,references -tiny tinyint(4) MUL 0 select,insert,update,references -short smallint(6) MUL 1 select,insert,update,references -medium mediumint(8) MUL 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) MUL 0 select,insert,update,references -real_float float(13,1) MUL 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned MUL 0 select,insert,update,references -ushort smallint(5) unsigned zerofill MUL 00000 select,insert,update,references -umedium mediumint(8) unsigned MUL 0 select,insert,update,references -ulong int(11) unsigned MUL 0 select,insert,update,references -ulonglong bigint(13) unsigned MUL 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field date YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -blob_col blob YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -longblob_col longblob select,insert,update,references -options enum('one','two','tree') character set latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary PRI NULL auto_increment select,insert,update,references +string varchar(10) latin1 YES hello select,insert,update,references +tiny tinyint(4) binary MUL 0 select,insert,update,references +short smallint(6) binary MUL 1 select,insert,update,references +medium mediumint(8) binary MUL 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary MUL 0 select,insert,update,references +real_float float(13,1) binary MUL 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary MUL 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary MUL 00000 select,insert,update,references +umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references +ulong int(11) unsigned binary MUL 0 select,insert,update,references +ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field date latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +blob_col blob binary YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +longblob_col longblob binary select,insert,update,references +options enum('one','two','tree') latin1 MUL one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE @@ -168,57 +168,57 @@ drop table t2; create table t2 select * from t1; update t2 set string="changed" where auto=16; show full columns from t1; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned MUL NULL auto_increment select,insert,update,references -string varchar(10) character set latin1 YES new defaul select,insert,update,references -tiny tinyint(4) MUL 0 select,insert,update,references -short smallint(6) MUL 0 select,insert,update,references -medium mediumint(8) MUL 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) MUL 0 select,insert,update,references -real_float float(13,1) MUL 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned 0 select,insert,update,references -ushort smallint(5) unsigned zerofill 00000 select,insert,update,references -umedium mediumint(8) unsigned MUL 0 select,insert,update,references -ulong int(11) unsigned MUL 0 select,insert,update,references -ulonglong bigint(13) unsigned MUL 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field varchar(10) character set latin1 YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') character set latin1 MUL one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references -new_field varchar(10) character set latin1 new select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary MUL NULL auto_increment select,insert,update,references +string varchar(10) latin1 YES new defaul select,insert,update,references +tiny tinyint(4) binary MUL 0 select,insert,update,references +short smallint(6) binary MUL 0 select,insert,update,references +medium mediumint(8) binary MUL 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary MUL 0 select,insert,update,references +real_float float(13,1) binary MUL 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references +umedium mediumint(8) unsigned binary MUL 0 select,insert,update,references +ulong int(11) unsigned binary MUL 0 select,insert,update,references +ulonglong bigint(13) unsigned binary MUL 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field varchar(10) latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) latin1 YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +options enum('one','two','tree') latin1 MUL one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references +new_field varchar(10) latin1 new select,insert,update,references show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto int(5) unsigned 0 select,insert,update,references -string varchar(10) character set latin1 YES new defaul select,insert,update,references -tiny tinyint(4) 0 select,insert,update,references -short smallint(6) 0 select,insert,update,references -medium mediumint(8) 0 select,insert,update,references -long_int int(11) 0 select,insert,update,references -longlong bigint(13) 0 select,insert,update,references -real_float float(13,1) 0.0 select,insert,update,references -real_double double(16,4) YES NULL select,insert,update,references -utiny tinyint(3) unsigned 0 select,insert,update,references -ushort smallint(5) unsigned zerofill 00000 select,insert,update,references -umedium mediumint(8) unsigned 0 select,insert,update,references -ulong int(11) unsigned 0 select,insert,update,references -ulonglong bigint(13) unsigned 0 select,insert,update,references -time_stamp timestamp YES NULL select,insert,update,references -date_field varchar(10) character set latin1 YES NULL select,insert,update,references -time_field time YES NULL select,insert,update,references -date_time datetime YES NULL select,insert,update,references -new_blob_col varchar(20) character set latin1 YES NULL select,insert,update,references -tinyblob_col tinyblob YES NULL select,insert,update,references -mediumblob_col mediumblob select,insert,update,references -options enum('one','two','tree') character set latin1 one select,insert,update,references -flags set('one','two','tree') character set latin1 select,insert,update,references -new_field varchar(10) character set latin1 new select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto int(5) unsigned binary 0 select,insert,update,references +string varchar(10) latin1 YES new defaul select,insert,update,references +tiny tinyint(4) binary 0 select,insert,update,references +short smallint(6) binary 0 select,insert,update,references +medium mediumint(8) binary 0 select,insert,update,references +long_int int(11) binary 0 select,insert,update,references +longlong bigint(13) binary 0 select,insert,update,references +real_float float(13,1) binary 0.0 select,insert,update,references +real_double double(16,4) binary YES NULL select,insert,update,references +utiny tinyint(3) unsigned binary 0 select,insert,update,references +ushort smallint(5) unsigned zerofill binary 00000 select,insert,update,references +umedium mediumint(8) unsigned binary 0 select,insert,update,references +ulong int(11) unsigned binary 0 select,insert,update,references +ulonglong bigint(13) unsigned binary 0 select,insert,update,references +time_stamp timestamp latin1 YES NULL select,insert,update,references +date_field varchar(10) latin1 YES NULL select,insert,update,references +time_field time latin1 YES NULL select,insert,update,references +date_time datetime latin1 YES NULL select,insert,update,references +new_blob_col varchar(20) latin1 YES NULL select,insert,update,references +tinyblob_col tinyblob binary YES NULL select,insert,update,references +mediumblob_col mediumblob binary select,insert,update,references +options enum('one','two','tree') latin1 one select,insert,update,references +flags set('one','two','tree') latin1 select,insert,update,references +new_field varchar(10) latin1 new select,insert,update,references select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); auto auto 16 16 @@ -228,12 +228,12 @@ auto auto drop table t2; create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, "a" as t2, repeat("a",256) as t3, binary repeat("b",256) as t4 from t1; show full columns from t2; -Field Type Null Key Default Extra Privileges Comment -auto bigint(17) unsigned PRI 0 select,insert,update,references -t1 bigint(1) 0 select,insert,update,references -t2 char(1) character set latin1 select,insert,update,references -t3 mediumtext character set latin1 select,insert,update,references -t4 mediumblob select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +auto bigint(17) unsigned binary PRI 0 select,insert,update,references +t1 bigint(1) binary 0 select,insert,update,references +t2 char(1) latin1 select,insert,update,references +t3 mediumtext latin1 select,insert,update,references +t4 mediumblob binary select,insert,update,references select * from t2; auto t1 t2 t3 t4 11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb @@ -251,10 +251,10 @@ create table t3 select * from t1, t2; Duplicate column name 'c' create table t3 select t1.c AS c1, t2.c AS c2,1 as "const" from t1, t2; show full columns from t3; -Field Type Null Key Default Extra Privileges Comment -c1 int(11) YES NULL select,insert,update,references -c2 int(11) YES NULL select,insert,update,references -const bigint(1) 0 select,insert,update,references +Field Type Collation Null Key Default Extra Privileges Comment +c1 int(11) binary YES NULL select,insert,update,references +c2 int(11) binary YES NULL select,insert,update,references +const bigint(1) binary 0 select,insert,update,references drop table t1,t2,t3; create table t1 ( myfield INT NOT NULL, UNIQUE INDEX (myfield), unique (myfield), index(myfield)); drop table t1; diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result index 256937c586a..b0ea1b69e59 100644 --- a/mysql-test/r/type_set.result +++ b/mysql-test/r/type_set.result @@ -3,13 +3,13 @@ create table t1 (a set (' ','a','b') not null); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') character set latin1 NOT NULL default '' + `a` set('','a','b') NOT NULL default '' ) TYPE=MyISAM CHARSET=latin1 drop table t1; create table t1 (a set (' ','a','b ') not null default 'b '); show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `a` set('','a','b') character set latin1 NOT NULL default 'b' + `a` set('','a','b') NOT NULL default 'b' ) TYPE=MyISAM CHARSET=latin1 drop table t1; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 3930e5e25c1..e546a8c8284 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -85,7 +85,7 @@ a b 2 b 1 a (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b; -Table 't1' from one of SELECT's can not be used in order clause +Table 't1' from one of SELECT's can not be used in global ORDER clause explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 @@ -170,7 +170,6 @@ testtt tsestset 1 drop table t1; -drop table if exists t1,t2; create table t1 (a int); create table t2 (a int); insert into t1 values (1),(2),(3),(4),(5); diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index ba5c1c6e28f..159b971440b 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; create table t1 (a int auto_increment , primary key (a)); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); update t1 set a=a+10 where a > 34; @@ -106,9 +106,12 @@ create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(1,3); update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b desc limit 1; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; a b 1 4 1 2 1 4 -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 1b0b359c533..6e3b9309351 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -1,10 +1,10 @@ +drop table if exists t1,t2; set @a := foo; Unknown column 'foo' in 'field list' set @a := connection_id() + 3; select @a - connection_id(); @a - connection_id() 3 -drop table if exists t1,t2; CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result index 7ce0f78da76..2d04da31caa 100644 --- a/mysql-test/r/varbinary.result +++ b/mysql-test/r/varbinary.result @@ -1,3 +1,4 @@ +drop table if exists t1; select 0x41,0x41+0,0x41 | 0x7fffffffffffffff | 0,0xffffffffffffffff | 0 ; 0x41 0x41+0 0x41 | 0x7fffffffffffffff | 0 0xffffffffffffffff | 0 A 65 9223372036854775807 18446744073709551615 @@ -7,7 +8,6 @@ select 0x31+1,concat(0x31)+1,-0xf; select x'31',X'ffff'+0; x'31' X'ffff'+0 1 65535 -drop table if exists t1; create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) ); insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index fbbf7fcb8f4..b66d75e2b3a 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1,4 +1,4 @@ -drop table if exists t1; +drop table if exists t1,t2; set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; @test @`select` @TEST @not_used @@ -48,6 +48,9 @@ set max_join_size=100; show variables like 'max_join_size'; Variable_name Value max_join_size 100 +show global variables like 'max_join_size'; +Variable_name Value +max_join_size HA_POS_ERROR set GLOBAL max_join_size=2000; show global variables like 'max_join_size'; Variable_name Value @@ -59,7 +62,7 @@ max_join_size 2000 set GLOBAL max_join_size=DEFAULT; show global variables like 'max_join_size'; Variable_name Value -max_join_size 18446744073709551615 +max_join_size HA_POS_ERROR set @@max_join_size=1000, @@global.max_join_size=2000; select @@local.max_join_size, @@global.max_join_size; @@session.max_join_size @@global.max_join_size @@ -312,7 +315,6 @@ set tmp_table_size=100; set tx_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; -DROP TABLE IF EXISTS t1,t2; create table t1 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a)); insert into t1 values(null),(null),(null); diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index e5713718db0..f2a105827da 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -1,4 +1,6 @@ drop table if exists t1; +Warnings: +Note 1051 Unknown table 't1' create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); @@ -8,3 +10,23 @@ insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); drop table t1; set SQL_WARNINGS=0; +drop temporary table if exists not_exists; +Warnings: +Note 1051 Unknown table 'not_exists' +drop table if exists not_exists_table; +Warnings: +Note 1051 Unknown table 'not_exists_table' +show warnings limit 1; +Level Code Message +Note 1051 Unknown table 'not_exists_table' +drop database if exists not_exists_db; +Warnings: +Note 1008 Can't drop database 'not_exists_db'. Database doesn't exist +show count(*) warnings; +@@session.warning_count +1 +create table t1(id int); +create table if not exists t1(id int); +select @@warning_count; +@@warning_count +0 diff --git a/mysql-test/t/alias.test b/mysql-test/t/alias.test index 5c6813d93aa..64dd481d37d 100644 --- a/mysql-test/t/alias.test +++ b/mysql-test/t/alias.test @@ -1,4 +1,7 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( cont_nr int(11) NOT NULL auto_increment, ver_nr int(11) NOT NULL default '0', diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 1c3987e2a31..64b657f1146 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1,8 +1,10 @@ # # Test of alter table # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 ( col1 int not null auto_increment primary key, col2 varchar(30) not null, diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test index 68b038c089f..ccbfb56a801 100644 --- a/mysql-test/t/analyse.test +++ b/mysql-test/t/analyse.test @@ -2,7 +2,9 @@ # Test of procedure analyse # +--disable_warnings drop table if exists t1,t2; +--enable_warnings create table t1 (i int, j int); insert into t1 values (1,2), (3,4), (5,6), (7,8); select * from t1 procedure analyse(); @@ -10,4 +12,4 @@ create table t2 select * from t1 procedure analyse(); select * from t2; drop table t1,t2; -EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
\ No newline at end of file +EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index d86466572d8..30979202bd7 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -1,8 +1,10 @@ # # Test of auto_increment; The test for BDB tables is in bdb.test # - +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index ad332cde646..8939d281eda 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -2,7 +2,9 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; set SQL_LOG_BIN=0; -drop table if exists t1; +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings create table t1(n int); --replace_result "errno = 2" "errno = X" "errno = 22" "errno = X" "errno = 23" "errno = X" backup table t1 to '../bogus'; diff --git a/mysql-test/t/bdb-alter-table-1.test b/mysql-test/t/bdb-alter-table-1.test index 5861c2fe0bf..7537cc358e8 100644 --- a/mysql-test/t/bdb-alter-table-1.test +++ b/mysql-test/t/bdb-alter-table-1.test @@ -2,7 +2,10 @@ # Test of problem when shutting down mysqld at once after ALTER TABLE # -- source include/have_bdb.inc +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1(objid BIGINT not null, tablename varchar(64), oid BIGINT not null, test BIGINT, PRIMARY KEY (objid), UNIQUE(tablename)) type=BDB; insert into t1 values(1, 't1',4,9); insert into t1 values(2, 'metatable',1,9); diff --git a/mysql-test/t/bdb-crash.test b/mysql-test/t/bdb-crash.test index 0005b631a46..956645b1188 100644 --- a/mysql-test/t/bdb-crash.test +++ b/mysql-test/t/bdb-crash.test @@ -2,7 +2,9 @@ # test for bug reported by Mark Steele +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 ( ChargeID int(10) unsigned DEFAULT '0' NOT NULL auto_increment, ServiceID int(10) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test index 5ecfe592ce4..2453c42e49a 100644 --- a/mysql-test/t/bdb-deadlock.test +++ b/mysql-test/t/bdb-deadlock.test @@ -11,7 +11,9 @@ 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) type=BDB; create table t2 (id integer, x integer) type=BDB; diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test index 608d4bf5042..27755e51b7f 100644 --- a/mysql-test/t/bdb.test +++ b/mysql-test/t/bdb.test @@ -4,7 +4,9 @@ # Small basic test with ignore # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; +--enable_warnings create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=bdb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -441,7 +443,6 @@ drop table t1; # This gave a wrong result because the row information was freed too early # -drop table if exists t1, t2, t3, t4, t5, t6, t7; create table t1 ( branch_id int auto_increment primary key, @@ -451,7 +452,6 @@ create table t1 unique branch_name(branch_name), index branch_active(branch_active) ) type=bdb; -drop table if exists t2 ; create table t2 ( target_id int auto_increment primary key, @@ -461,7 +461,6 @@ create table t2 unique target_name(target_name), index target_active(target_active) ) type=bdb; -drop table if exists t3 ; create table t3 ( platform_id int auto_increment primary key, @@ -471,7 +470,6 @@ create table t3 unique platform_name(platform_name), index platform_active(platform_active) ) type=bdb; -drop table if exists t4 ; create table t4 ( product_id int auto_increment primary key, @@ -482,7 +480,6 @@ create table t4 unique product_name(product_name), index product_active(product_active) ) type=bdb; -drop table if exists t5 ; create table t5 ( product_file_id int auto_increment primary key, @@ -496,7 +493,6 @@ create table t5 unique product_file(product_id,file_name), index file_included(file_included) ) type=bdb; -drop table if exists t6 ; create table t6 ( file_platform_id int auto_increment primary key, @@ -510,7 +506,6 @@ create table t6 unique file_platform(product_file_id,platform_id,branch_id) ) type=bdb; -drop table if exists t8 ; create table t8 ( archive_id int auto_increment primary key, @@ -523,7 +518,6 @@ create table t8 unique archive(branch_id,target_id,platform_id,product_id), index status_id(status_id) ) type=bdb; -drop table if exists t7 ; create table t7 ( build_id int auto_increment primary key, @@ -727,7 +721,6 @@ DROP TABLE t1,t2; # Test problem with joining table to itself on a multi-part unique key # -drop table if exists t1; create table t1 (a int(11) not null, b int(11) not null, unique (a,b)) type=bdb; insert into t1 values (1,1), (1,2); select * from t1 where a = 1; diff --git a/mysql-test/t/bdb_cache.test b/mysql-test/t/bdb_cache.test index b1343c5e83e..0d7de75ccf6 100644 --- a/mysql-test/t/bdb_cache.test +++ b/mysql-test/t/bdb_cache.test @@ -4,7 +4,9 @@ # # Without auto_commit. # +--disable_warnings drop table if exists t1, t2, t3; +--enable_warnings flush status; set autocommit=0; create table t1 (a int not null) type=bdb; diff --git a/mysql-test/t/bench_count_distinct.test b/mysql-test/t/bench_count_distinct.test index 9059428bea4..c1adeab2c44 100644 --- a/mysql-test/t/bench_count_distinct.test +++ b/mysql-test/t/bench_count_distinct.test @@ -1,4 +1,10 @@ +# +# Test of count(distinct ..) +# + +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int not null, key(n)) delay_key_write = 1; let $1=100; disable_query_log; diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test index 15c61c2c0dc..3dde4b8a2c1 100644 --- a/mysql-test/t/bigint.test +++ b/mysql-test/t/bigint.test @@ -1,4 +1,11 @@ # +# Initialize + +--disable_warnings +drop table if exists t1; +--enable_warnings + +# # Test of reading of bigint values # select 0,256,00000000000000065536,2147483647,-2147483648,2147483648,+4294967296; @@ -11,7 +18,6 @@ select +9999999999999999999,-9999999999999999999; # This will work on 4.0 as we then have internal handling of bigint variables. # -drop table if exists t1; create table t1 (a bigint unsigned not null, primary key(a)); insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE); select * from t1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index fc2d91e20fe..0a5dd71f98e 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -1,8 +1,10 @@ # # test sort,min and max on binary fields # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (name char(20) not null, primary key (name)); create table t2 (name char(20) binary not null, primary key (name)); insert into t1 values ("å"); diff --git a/mysql-test/t/bool.test b/mysql-test/t/bool.test index 10f97fefb73..c001973baeb 100644 --- a/mysql-test/t/bool.test +++ b/mysql-test/t/bool.test @@ -2,7 +2,9 @@ # Test of boolean operations with NULL # +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings SELECT IF(NULL AND 1, 1, 2), IF(1 AND NULL, 1, 2); SELECT NULL AND 1, 1 AND NULL, 0 AND NULL, NULL and 0; @@ -33,19 +35,17 @@ DROP TABLE t1; # Read nA as !A, AB as A && B, AoB as A || B # Result table makes ANSI happy -drop table if exists t; -create table t(a int, b int); -insert into t values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); +create table t1 (a int, b int); +insert into t1 values(null, null), (0, null), (1, null), (null, 0), (null, 1), (0, 0), (0, 1), (1, 0), (1, 1); # Below test is valid untill we have True/False implemented as 1/0 # To comply to all rules it must show that: n(AB) = nAonB, n(AoB) = nAnB -select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t; +select ifnull(A, 'N') as A, ifnull(B, 'N') as B, ifnull(not A, 'N') as nA, ifnull(not B, 'N') as nB, ifnull(A and B, 'N') as AB, ifnull(not (A and B), 'N') as `n(AB)`, ifnull((not A or not B), 'N') as nAonB, ifnull(A or B, 'N') as AoB, ifnull(not(A or B), 'N') as `n(AoB)`, ifnull(not A and not B, 'N') as nAnB from t1; # This should work with any internal representation of True/False # Result must be same as above -select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t; +select ifnull(A=1, 'N') as A, ifnull(B=1, 'N') as B, ifnull(not (A=1), 'N') as nA, ifnull(not (B=1), 'N') as nB, ifnull((A=1) and (B=1), 'N') as AB, ifnull(not ((A=1) and (B=1)), 'N') as `n(AB)`, ifnull((not (A=1) or not (B=1)), 'N') as nAonB, ifnull((A=1) or (B=1), 'N') as AoB, ifnull(not((A=1) or (B=1)), 'N') as `n(AoB)`, ifnull(not (A=1) and not (B=1), 'N') as nAnB from t1; - -drop table t; +drop table t1; diff --git a/mysql-test/t/bulk_replace.test b/mysql-test/t/bulk_replace.test index d366004c16f..755d34083f8 100644 --- a/mysql-test/t/bulk_replace.test +++ b/mysql-test/t/bulk_replace.test @@ -1,11 +1,10 @@ # # this is a test of bulk-insert code -# as used by REPLACE -# -# by Monty # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 (a int, unique (a), b int not null, unique(b), c int not null, index(c)); replace into t1 values (1,1,1),(2,2,2),(3,1,3); select * from t1; diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 79511f5f546..6131d1500de 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -2,7 +2,9 @@ # Testing of CASE # +--disable_warnings drop table if exists t1; +--enable_warnings select CASE "b" when "a" then 1 when "b" then 2 END; select CASE "c" when "a" then 1 when "b" then 2 END; @@ -30,3 +32,12 @@ insert into t1 values(1),(2),(3),(4); select case a when 1 then 2 when 2 then 3 else 0 end as fcase, count(*) from t1 group by fcase; select case a when 1 then "one" when 2 then "two" else "nothing" end as fcase, count(*) from t1 group by fcase; drop table t1; + +# +# Test MAX(CASE ... ) that can return null +# + +create table t1 (row int not null, col int not null, val varchar(255) not null); +insert into t1 values (1,1,'orange'),(1,2,'large'),(2,1,'yellow'),(2,2,'medium'),(3,1,'green'),(3,2,'small'); +select max(case col when 1 then val else null end) as color from t1 group by row; +drop table t1; diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index 947566e725b..bc61aea2d66 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -1,8 +1,11 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; +--disable_warnings drop table if exists t1; -#add a lot of keys to slow down check +--enable_warnings + +# Add a lot of keys to slow down check create table t1(n int not null, key(n), key(n), key(n), key(n)); let $1=10000; disable_query_log; diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test index 450d9c0961c..e5a2e310866 100644 --- a/mysql-test/t/compare.test +++ b/mysql-test/t/compare.test @@ -2,7 +2,10 @@ # Bug when using comparions of strings and integers. # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id)); insert into t1 values ('000000000001'),('000000000002'); explain select * from t1 where id=000000000001; diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 0bc5ca3914f..7b441ee5f7b 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -41,7 +41,6 @@ show tables; #--error 1045 - # check if old password version also works update mysql.user set password=old_password("gambling2") where user="test"; flush privileges; @@ -63,5 +62,3 @@ show tables; #--error 1045 #connect (con1,localhost,test,zorro,); #--error 1045 - - diff --git a/mysql-test/t/constraints.test b/mysql-test/t/constraints.test index 8682cdc42a2..cc796e0abd2 100644 --- a/mysql-test/t/constraints.test +++ b/mysql-test/t/constraints.test @@ -2,7 +2,9 @@ # Testing of constraints # Currently MySQL only ignores the syntax. # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a int check (a>0)); insert into t1 values (1); diff --git a/mysql-test/t/count_distinct.test b/mysql-test/t/count_distinct.test index 3d795d44821..c7740e73ee8 100644 --- a/mysql-test/t/count_distinct.test +++ b/mysql-test/t/count_distinct.test @@ -2,7 +2,10 @@ # Problem with count(distinct) # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table t1 (libname varchar(21) not null, city text, primary key (libname)); create table t2 (isbn varchar(21) not null, author text, title text, primary key (isbn)); create table t3 (isbn varchar(21) not null, libname varchar(21) not null, quantity int ,primary key (isbn,libname)); diff --git a/mysql-test/t/count_distinct2.test b/mysql-test/t/count_distinct2.test index d1bea7614c8..9100f622dec 100644 --- a/mysql-test/t/count_distinct2.test +++ b/mysql-test/t/count_distinct2.test @@ -1,4 +1,6 @@ +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n1 int, n2 int, s char(20), vs varchar(20), t text); insert into t1 values (1,11, 'one','eleven', 'eleven'), diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 3bad053875c..70a589c4be6 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -2,7 +2,10 @@ # Check some special create statements. # -drop table if exists t1,t2; +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + create table t1 (b char(0)); insert into t1 values (""),(null); select * from t1; @@ -12,7 +15,7 @@ create table t1 (b char(0) not null); create table if not exists t1 (b char(0) not null); insert into t1 values (""),(null); select * from t1; -drop table if exists t1; +drop table t1; # # Test of some CREATE TABLE'S that should fail @@ -91,11 +94,14 @@ create table t2 (a int) select * from t1; describe t1; describe t2; drop table if exists t2; -!$1060 create table t2 (a int, a float) select * from t1; +--error 1060 +create table t2 (a int, a float) select * from t1; drop table if exists t2; -!$1060 create table t2 (a int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (a int) select a as b, a+1 as b from t1; drop table if exists t2; -!$1060 create table t2 (b int) select a as b, a+1 as b from t1; +--error 1060 +create table t2 (b int) select a as b, a+1 as b from t1; drop table if exists t1,t2; # @@ -113,3 +119,43 @@ drop table if exists t1; create table t1 (a int, key(a)); create table t2 (b int, foreign key(b) references t1(a), key(b)); drop table if exists t1,t2; + +# +# Test for CREATE TABLE .. LIKE .. +# + +create table t1(id int not null, name char(20)); +insert into t1 values(10,'mysql'),(20,'monty- the creator'); +create table t2(id int not null); +insert into t2 values(10),(20); +create table t3 like t1; +show create table t3; +select * from t3; +create table if not exists t3 like t1; +select @@warning_count; +create temporary table t3 like t2; +show create table t3; +select * from t3; +drop table t3; +show create table t3; +select * from t3; +drop table t2, t3; +drop database if exists test_$1; +create database test_$1; +create table test_$1.t3 like t1; +create temporary table t3 like test_$1.t3; +show create table t3; +create table t2 like t3; +show create table t2; +select * from t2; +create table t3 like t1; +!$1050 create table t3 like test_$1.t3; +--error 1044,1 +create table non_existing_database.t1 like t1; +!$1051 create table t3 like non_existing_table; +!$1050 create temporary table t3 like t1; +!$1103 create table t3 like `a/a`; +drop table t1, t2, t3; +drop table t3; +drop database test_$1; + diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index e829005a229..a4b4b816ec4 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -1,7 +1,9 @@ # # Test latin_de character set # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a char (20) not null, b int not null auto_increment, index (a,b),index(b)); insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb'); insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf'); diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test index 7854bc38d6f..5530eee0dbe 100644 --- a/mysql-test/t/ctype_many.test +++ b/mysql-test/t/ctype_many.test @@ -1,8 +1,10 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings CREATE TABLE t1 ( comment CHAR(32) ASCII NOT NULL, - koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL + koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL ) CHARSET=latin5; SHOW CREATE TABLE t1; @@ -137,9 +139,12 @@ SELECT CONVERT(koi8_ru_f USING utf8),MIN(comment),COUNT(*) FROM t1 GROUP BY 1; ALTER TABLE t1 ADD utf8_f CHAR(32) CHARACTER SET utf8 NOT NULL; UPDATE t1 SET utf8_f=CONVERT(koi8_ru_f USING utf8); - SELECT * FROM t1; +ALTER TABLE t1 ADD bin_f CHAR(32) BYTE NOT NULL; +UPDATE t1 SET bin_f=koi8_ru_f; +SELECT COUNT(DISTINCT bin_f),COUNT(DISTINCT koi8_ru_f),COUNT(DISTINCT utf8_f) FROM t1; + SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1; SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1; SELECT DISTINCT koi8_ru_f FROM t1; @@ -153,7 +158,7 @@ ORDER BY t11.koi8_ru_f,t11.comment,t12.comment; SELECT t11.comment,t12.comment FROM t1 t11,t1 t12 -WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8_ru) +WHERE t11.koi8_ru_f=CONVERT(t12.utf8_f USING koi8r) ORDER BY t12.utf8_f,t11.comment,t12.comment; ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2; diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 67111ea1734..4cf26b330c6 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -3,7 +3,9 @@ # (Can't be tested with purify :( ) # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (a char(10), tmsp timestamp); insert into t1 set a = 1; insert delayed into t1 set a = 2; diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test index 704fb7ada1c..57321739bfb 100644 --- a/mysql-test/t/delete.test +++ b/mysql-test/t/delete.test @@ -2,7 +2,9 @@ # Check for problems with delete # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 (a tinyint(3), b tinyint(5)); INSERT INTO t1 VALUES (1,1); INSERT LOW_PRIORITY INTO t1 VALUES (1,2); @@ -36,7 +38,6 @@ insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(2 delete from t1 where a=27; drop table t1; -drop table if exists t; CREATE TABLE `t` ( `i` int(10) NOT NULL default '0', `i2` int(10) NOT NULL default '0', @@ -44,4 +45,4 @@ CREATE TABLE `t` ( ) TYPE=MyISAM CHARSET=latin1; -- error 1054 DELETE FROM t USING t WHERE post='1'; -drop table if exists t;
\ No newline at end of file +drop table if exists t; diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index 5f63cea3c11..6d1d825a523 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -1,4 +1,13 @@ +# Initialize +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + +select * from (select 2 from DUAL) b; +-- error 1054 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; +-- error 1054 +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -20,7 +29,7 @@ SELECT 1 FROM (SELECT 1) a WHERE a=2; SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1) as a; select * from t1 as x1, (select * from t1) as x2; explain select * from t1 as x1, (select * from t1) as x2; -drop table if exists t1.t2,t3; +drop table if exists t2,t3; select * from (select 1) as a; select a from (select 1 as a) as b; select 1 from (select 1) as a; @@ -40,6 +49,12 @@ while ($1) enable_query_log; SELECT * FROM (SELECT * FROM t1) as b ORDER BY a ASC LIMIT 0,20; explain select count(*) from t1 as tt1, (select * from t1) as tt2; -drop table if exists t1; +drop table t1; SELECT * FROM (SELECT (SELECT * FROM (SELECT 1 as a) as a )) as b; select * from (select 1 as a) b left join (select 2 as a) c using(a); +--error 1054 +SELECT * FROM (SELECT 1 UNION SELECT a) b; +--error 1054 +SELECT 1 as a FROM (SELECT a UNION SELECT 1) b; +--error 1054 +SELECT 1 as a FROM (SELECT 1 UNION SELECT a) b; diff --git a/mysql-test/t/dirty_close.test b/mysql-test/t/dirty_close.test index 3ed22f26d5b..f965df8cfea 100644 --- a/mysql-test/t/dirty_close.test +++ b/mysql-test/t/dirty_close.test @@ -3,7 +3,11 @@ connect (con2,localhost,root,,); connection con1; dirty_close con1; connection con2; + +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (n int); insert into t1 values (1),(2),(3); select * from t1; diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 7f75b6b1687..859c4042b1d 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -3,7 +3,9 @@ # Bug with group by and not used fields # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 (id int,facility char(20)); CREATE TABLE t2 (facility char(20)); @@ -198,7 +200,6 @@ drop table t1,t2,t3; # This also test the case when one doesn't use all fields in GROUP BY. # -drop table if exists t1; create table t1 (a int not null, b int not null, t time); insert into t1 values (1,1,"00:06:15"),(1,2,"00:06:15"),(1,2,"00:30:15"),(1,3,"00:06:15"),(1,3,"00:30:15"); select a,sec_to_time(sum(time_to_sec(t))) from t1 group by a,b; @@ -261,7 +262,7 @@ INSERT INTO t1 VALUES (128,0,33,33,8,':D','',996121863,1,0,2,996122850,2,0,0); CREATE TABLE t2 (userid int(10) unsigned NOT NULL auto_increment, usergroupid smallint(5) unsigned NOT NULL default '0', username varchar(50) NOT NULL default '', password varchar(50) NOT NULL default '', email varchar(50) NOT NULL default '', styleid smallint(5) unsigned NOT NULL default '0', parentemail varchar(50) NOT NULL default '', coppauser smallint(6) NOT NULL default '0', homepage varchar(100) NOT NULL default '', icq varchar(20) NOT NULL default '', aim varchar(20) NOT NULL default '', yahoo varchar(20) NOT NULL default '', signature mediumtext NOT NULL, adminemail smallint(6) NOT NULL default '0', showemail smallint(6) NOT NULL default '0', invisible smallint(6) NOT NULL default '0', usertitle varchar(250) NOT NULL default '', customtitle smallint(6) NOT NULL default '0', joindate int(10) unsigned NOT NULL default '0', cookieuser smallint(6) NOT NULL default '0', daysprune smallint(6) NOT NULL default '0', lastvisit int(10) unsigned NOT NULL default '0', lastactivity int(10) unsigned NOT NULL default '0', lastpost int(10) unsigned NOT NULL default '0', posts smallint(5) unsigned NOT NULL default '0', timezoneoffset varchar(4) NOT NULL default '', emailnotification smallint(6) NOT NULL default '0', buddylist mediumtext NOT NULL, ignorelist mediumtext NOT NULL, pmfolders mediumtext NOT NULL, receivepm smallint(6) NOT NULL default '0', emailonpm smallint(6) NOT NULL default '0', pmpopup smallint(6) NOT NULL default '0', avatarid smallint(6) NOT NULL default '0', avatarrevision int(6) unsigned NOT NULL default '0', options smallint(6) NOT NULL default '15', birthday date NOT NULL default '0000-00-00', maxposts smallint(6) NOT NULL default '-1', startofweek smallint(6) NOT NULL default '1', ipaddress varchar(20) NOT NULL default '', referrerid int(10) unsigned NOT NULL default '0', nosessionhash smallint(6) NOT NULL default '0', autorefresh smallint(6) NOT NULL default '-1', messagepopup tinyint(2) NOT NULL default '0', inforum smallint(5) unsigned NOT NULL default '0', ratenum smallint(5) unsigned NOT NULL default '0', ratetotal smallint(5) unsigned NOT NULL default '0', allowrate smallint(5) unsigned NOT NULL default '1', PRIMARY KEY (userid), KEY usergroupid (usergroupid), KEY username (username), KEY inforum (inforum)) TYPE=MyISAM; INSERT INTO t2 VALUES (33,6,'Kevin','0','kevin@stileproject.com',1,'',0,'http://www.stileproject.com','','','','',1,1,0,'Administrator',0,996120694,1,-1,1030996168,1031027028,1030599436,36,'-6',0,'','','',1,0,1,0,0,15,'0000-00-00',-1,1,'64.0.0.0',0,1,-1,0,0,4,19,1); SELECT DISTINCT t1.*, t2.* FROM t1 LEFT JOIN t2 ON (t2.userid = t1.touserid); -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; # # test with const_item in ORDER BY @@ -272,5 +273,4 @@ INSERT t1 VALUES (1,2,3); CREATE TABLE t2 (a int primary key, b int, c int); INSERT t2 VALUES (3,4,5); SELECT DISTINCT t1.a, t2.b FROM t1, t2 WHERE t1.a=1 ORDER BY t2.c; -DROP TABLE IF EXISTS t1,t2; - +DROP TABLE t1,t2; diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index c92f2b1f3b9..307dd45654d 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -1,5 +1,8 @@ +# Initialise +--disable_warnings drop table if exists t1; -drop table if exists t1; +--enable_warnings + --error 1051; drop table t1; create table t1(n int); diff --git a/mysql-test/t/empty_table.test b/mysql-test/t/empty_table.test index 9ea79ee157f..db0a8e6a247 100644 --- a/mysql-test/t/empty_table.test +++ b/mysql-test/t/empty_table.test @@ -2,7 +2,10 @@ # Some special cases with empty tables # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); select count(*) from t1; select * from t1; diff --git a/mysql-test/t/err000001.test b/mysql-test/t/err000001.test index d9898054a83..b558c90b0c6 100644 --- a/mysql-test/t/err000001.test +++ b/mysql-test/t/err000001.test @@ -2,18 +2,30 @@ # Test some error conditions # +--disable_warnings drop table if exists t1; -!$1146 insert into t1 values(1); -!$1146 delete from t1; -!$1146 update t1 set a=1; +--enable_warnings +--error 1146 +insert into t1 values(1); +--error 1146 +delete from t1; +--error 1146 +update t1 set a=1; create table t1 (a int); -!$1054 select count(test.t1.b) from t1; -!$1109 select count(not_existing_database.t1) from t1; -!$1109 select count(not_existing_database.t1.a) from t1; +--error 1054 +select count(test.t1.b) from t1; +--error 1109 +select count(not_existing_database.t1) from t1; +--error 1109 +select count(not_existing_database.t1.a) from t1; --error 1044,1146 select count(not_existing_database.t1.a) from not_existing_database.t1; -!$1054 select 1 from t1 order by 2; -!$1054 select 1 from t1 group by 2; -!$1054 select 1 from t1 order by t1.b; -!$1054 select count(*),b from t1; +--error 1054 +select 1 from t1 order by 2; +--error 1054 +select 1 from t1 group by 2; +--error 1054 +select 1 from t1 order by t1.b; +--error 1054 +select count(*),b from t1; drop table t1; diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test index 31a01ae1360..3e33d58215e 100644 --- a/mysql-test/t/explain.test +++ b/mysql-test/t/explain.test @@ -1,7 +1,9 @@ # # Test of different EXPLAIN's +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int not null, str char(10), unique(str)); insert into t1 values (1, null),(2, null),(3, "foo"),(4, "bar"); select * from t1 where str is null; diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 540aa4235cc..44a821b63c2 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -9,9 +9,13 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; -drop table if exists t1; + +--disable_warnings +drop table if exists t1,t2; +drop database if exists mysqltest; +--enable_warnings + create temporary table t1(n int not null primary key); -drop table if exists t2; create table t2(n int); insert into t2 values(3); let $1=100; @@ -44,7 +48,6 @@ reap; #test if drop database will wait until we release the global read lock connection con1; -drop database if exists mysqltest; create database mysqltest; create table mysqltest.t1(n int); insert into mysqltest.t1 values (23); diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test index 1afcb546f6a..8c35fd65f74 100644 --- a/mysql-test/t/foreign_key.test +++ b/mysql-test/t/foreign_key.test @@ -2,7 +2,10 @@ # Test syntax of foreign keys # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 ( a int not null references t2, b int not null references t2 (c), diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 5a64f2614aa..02c407abd6c 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -2,7 +2,9 @@ # Test of fulltext index # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b)); INSERT INTO t1 VALUES('MySQL has now support', 'for full-text search'), @@ -166,7 +168,6 @@ drop table t1; # ERROR 1030: Got error 127 from table handler # -drop table if exists t1; create table t1 (a text, fulltext key (a)); insert into t1 values ('aaaa'); repair table t1; diff --git a/mysql-test/t/fulltext_cache.test b/mysql-test/t/fulltext_cache.test index 0b15e57a97b..15f32fdb5a0 100644 --- a/mysql-test/t/fulltext_cache.test +++ b/mysql-test/t/fulltext_cache.test @@ -2,7 +2,10 @@ # Bugreport due to Roy Nasser <roy@vem.ca> # +--disable_warnings drop table if exists t1, t2; +--enable_warnings + CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, q varchar(255) default NULL, diff --git a/mysql-test/t/fulltext_distinct.test b/mysql-test/t/fulltext_distinct.test index 86e2f7ca1b4..2ccfb94c819 100644 --- a/mysql-test/t/fulltext_distinct.test +++ b/mysql-test/t/fulltext_distinct.test @@ -3,7 +3,10 @@ # bug reported by Tibor Simko <tibor.simko@cern.ch> # +--disable_warnings DROP TABLE IF EXISTS t1, t2; +--enable_warnings + CREATE TABLE t1 ( id mediumint unsigned NOT NULL auto_increment, tag char(6) NOT NULL default '', diff --git a/mysql-test/t/fulltext_left_join.test b/mysql-test/t/fulltext_left_join.test index bcf7cbcc505..4fce8ee287e 100644 --- a/mysql-test/t/fulltext_left_join.test +++ b/mysql-test/t/fulltext_left_join.test @@ -2,7 +2,10 @@ # Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr> # +--disable_warnings drop table if exists t1, t2; +--enable_warnings + CREATE TABLE t1 ( id VARCHAR(255) NOT NULL PRIMARY KEY, sujet VARCHAR(255), diff --git a/mysql-test/t/fulltext_multi.test b/mysql-test/t/fulltext_multi.test index 233c243146e..c312a5938b2 100644 --- a/mysql-test/t/fulltext_multi.test +++ b/mysql-test/t/fulltext_multi.test @@ -1,6 +1,8 @@ # several FULLTEXT indexes in one table test -use test; +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( a int(11) NOT NULL auto_increment, b text, diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test index 3b60ee77db2..f8afe49d95d 100644 --- a/mysql-test/t/fulltext_order_by.test +++ b/mysql-test/t/fulltext_order_by.test @@ -1,5 +1,7 @@ -use test; +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( a INT AUTO_INCREMENT PRIMARY KEY, message CHAR(20), diff --git a/mysql-test/t/fulltext_update.test b/mysql-test/t/fulltext_update.test index 9e2ce3ccba5..a1d133ba3fe 100644 --- a/mysql-test/t/fulltext_update.test +++ b/mysql-test/t/fulltext_update.test @@ -2,7 +2,9 @@ # Test for bug by voi@ims.at # +--disable_warnings drop table if exists test; +--enable_warnings CREATE TABLE test ( gnr INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, url VARCHAR(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test index d6da1d6a603..147367a6d27 100644 --- a/mysql-test/t/func_concat.test +++ b/mysql-test/t/func_concat.test @@ -2,7 +2,10 @@ # Test of problem with CONCAT_WS() and long separators. # +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( number INT NOT NULL, alpha CHAR(6) NOT NULL ); INSERT INTO t1 VALUES (1413006,'idlfmv'), (1413065,'smpsfz'),(1413127,'sljrhx'),(1413304,'qerfnd'); diff --git a/mysql-test/t/func_crypt.test b/mysql-test/t/func_crypt.test index 812bdade39f..af0ef661d06 100644 --- a/mysql-test/t/func_crypt.test +++ b/mysql-test/t/func_crypt.test @@ -1,3 +1,8 @@ select length(encrypt('foo', 'ff')) <> 0; --replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l. -select old_password('test'),length(password("1")),length(encrypt('test')),encrypt('test','aa'); + +# Test new and old password handling functions +select password("a",""), password("a",NULL), password("","a"), password(NULL,"a"); +select password("aaaaaaaaaaaaaaaa","a"), password("a","aaaaaaaaaaaaaaaa"); +select old_password('test'), length(password("1")), length(encrypt('test')), encrypt('test','aa'); +select old_password(""), old_password(NULL), password(""), password(NULL); diff --git a/mysql-test/t/func_date_add.test b/mysql-test/t/func_date_add.test index c0250c6ece4..35acfe84bee 100644 --- a/mysql-test/t/func_date_add.test +++ b/mysql-test/t/func_date_add.test @@ -2,7 +2,10 @@ # Test of DATE_ADD # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( visitor_id int(10) unsigned DEFAULT '0' NOT NULL, group_id int(10) unsigned DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/func_encrypt.test b/mysql-test/t/func_encrypt.test index 3b6acc54ec9..fbb71f850e2 100644 --- a/mysql-test/t/func_encrypt.test +++ b/mysql-test/t/func_encrypt.test @@ -1,6 +1,9 @@ -- source include/have_openssl.inc +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (x blob); insert into t1 values (des_encrypt('The quick red fox jumped over the lazy brown dog','The quick red fox jumped over the lazy brown dog')); insert into t1 values (des_encrypt('a','The quick red fox jumped over the lazy brown dog')); diff --git a/mysql-test/t/func_equal.test b/mysql-test/t/func_equal.test index 0d7a4ed9778..cbf589ffcc2 100644 --- a/mysql-test/t/func_equal.test +++ b/mysql-test/t/func_equal.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + # # Testing of the <=> operator # @@ -15,7 +20,6 @@ select "A"<=>"B","A"<=>NULL,NULL<=>"A"; # Test with tables # -drop table if exists t1,t2; create table t1 (id int, value int); create table t2 (id int, value int); diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 8a9a5655e1b..b6511779f51 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -2,7 +2,10 @@ # simple test of all group functions # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (grp int, a bigint unsigned, c char(10) not null); insert into t1 values (1,1,"a"); insert into t1 values (2,2,"b"); diff --git a/mysql-test/t/func_if.test b/mysql-test/t/func_if.test index 85553d1a2fd..21e5836c781 100644 --- a/mysql-test/t/func_if.test +++ b/mysql-test/t/func_if.test @@ -1,7 +1,9 @@ # # Init section # +--disable_warnings drop table if exists t1; +--enable_warnings # # Simple IF tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 7bbc560276f..723f1707a42 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -1,3 +1,7 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings # # test of IN (NULL) # @@ -14,7 +18,7 @@ select NULL in (1.5,2.5,3.5); select 1.5 in (1.5,NULL,3.5); select 3.5 in (1.5,NULL,3.5); select 10.5 in (1.5,NULL,3.5); -drop table if exists t1; + CREATE TABLE t1 (a int, b int, c int); insert into t1 values (1,2,3), (1,NULL,3); select 1 in (a,b,c) from t1; diff --git a/mysql-test/t/func_isnull.test b/mysql-test/t/func_isnull.test index bd3bcd8d04c..506efada0eb 100644 --- a/mysql-test/t/func_isnull.test +++ b/mysql-test/t/func_isnull.test @@ -2,7 +2,10 @@ # test of ISNULL() # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (id int auto_increment primary key not null, mydate date not null); insert into t1 values (0,"2002-05-01"),(0,"2002-05-01"),(0,"2002-05-01"); flush tables; diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test index 09746fcc817..47590ae7559 100644 --- a/mysql-test/t/func_like.test +++ b/mysql-test/t/func_like.test @@ -2,7 +2,10 @@ # Test of like # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a varchar(10), key(a)); insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test"); select * from t1 where a like "abc%"; diff --git a/mysql-test/t/func_regexp.test b/mysql-test/t/func_regexp.test index 7fbe4000cfc..6e5d601844e 100644 --- a/mysql-test/t/func_regexp.test +++ b/mysql-test/t/func_regexp.test @@ -2,7 +2,10 @@ # Some regexp tests # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (s1 char(64),s2 char(64)); insert into t1 values('aaa','aaa'); diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index cb1aa543d43..60d67a77562 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -15,3 +15,21 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N","" select elt(2,1),field(NULL,"a","b","c"); select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); + +# +# test for a bug with elt() +# + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +create table t1 (id int(10) not null unique); +create table t2 (id int(10) not null primary key, +val int(10) not null); +insert into t1 values (1),(2),(4); +insert into t2 values (1,1),(2,1),(3,1),(4,2); + +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; +select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; +drop table t1,t2; diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index d355cc95317..a87707746ba 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -4,7 +4,9 @@ # ----------- # Testing string functions +--disable_warnings drop table if exists t1; +--enable_warnings select 'hello',"'hello'",'""hello""','''h''e''l''l''o''',"hel""lo",'hel\'lo'; select 'hello' 'monty'; @@ -69,6 +71,7 @@ select decode(encode("abcdef","monty"),"monty")="abcdef"; select quote('\'\"\\test'); select quote(concat('abc\'', '\\cba')); select quote(1/0), quote('\0\Z'); +select length(quote(concat(char(0),"test"))); # # Wrong usage of functions diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 2e913bdf943..903b80eb12a 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1,7 +1,9 @@ # # time functions # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings select from_days(to_days("960101")),to_days(960201)-to_days("19960101"),to_days(date_add(curdate(), interval 1 day))-to_days(curdate()),weekday("1997-11-29"); select period_add("9602",-12),period_diff(199505,"9404") ; diff --git a/mysql-test/t/func_timestamp.test b/mysql-test/t/func_timestamp.test index 74e541f782d..8583c16073d 100644 --- a/mysql-test/t/func_timestamp.test +++ b/mysql-test/t/func_timestamp.test @@ -2,7 +2,10 @@ # Tests that depend on the timestamp and the TZ variable # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (Zeit time, Tag tinyint not null, Monat tinyint not null, Jahr smallint not null, index(Tag), index(Monat), index(Jahr) ); insert into t1 values ("09:26:00",16,9,1998),("09:26:00",16,9,1998); diff --git a/mysql-test/t/gcc296.test b/mysql-test/t/gcc296.test index 7c72b57ca54..ebca4dbc897 100644 --- a/mysql-test/t/gcc296.test +++ b/mysql-test/t/gcc296.test @@ -1,6 +1,9 @@ #try to crash gcc 2.96 -drop table if exists obory; -CREATE TABLE obory ( +--disable_warnings +drop table if exists t1; +--enable_warnings + +CREATE TABLE t1 ( kodoboru varchar(10) default NULL, obor tinytext, aobor tinytext, @@ -8,10 +11,10 @@ CREATE TABLE obory ( FULLTEXT KEY obor (obor), FULLTEXT KEY aobor (aobor) ); -INSERT INTO obory VALUES ('0101000000','aaa','AAA'); -INSERT INTO obory VALUES ('0102000000','bbb','BBB'); -INSERT INTO obory VALUES ('0103000000','ccc','CCC'); -INSERT INTO obory VALUES ('0104000000','xxx','XXX'); +INSERT INTO t1 VALUES ('0101000000','aaa','AAA'); +INSERT INTO t1 VALUES ('0102000000','bbb','BBB'); +INSERT INTO t1 VALUES ('0103000000','ccc','CCC'); +INSERT INTO t1 VALUES ('0104000000','xxx','XXX'); -select * from obory; -drop table obory; +select * from t1; +drop table t1; diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test index 09ce1021fbf..84091d9b830 100644 --- a/mysql-test/t/grant_cache.test +++ b/mysql-test/t/grant_cache.test @@ -3,12 +3,17 @@ # # Test grants with query cache # +--disable_warnings drop table if exists test.t1,mysqltest.t1,mysqltest.t2; +--enable_warnings + reset query cache; flush status; connect (root,localhost,root,,test,0,master.sock); connection root; +--disable_warnings create database if not exists mysqltest; +--enable_warnings create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t2 (a int,b int,c int); diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 4682463c11f..a34c3a12363 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1,10 +1,18 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + +# +# Simple test without tables + -- error 1111 SELECT 1 FROM (SELECT 1) as a GROUP BY SUM(1); + # # Test of group (Failed for Lars Hoss <lh@pbm.de>) # -drop table if exists t1,t2,t3; CREATE TABLE t1 ( spID int(10) unsigned, userID int(10) unsigned, @@ -40,7 +48,7 @@ INSERT INTO t2 VALUES (3,'name','pass','mail','Y','v','n','adr','1','1','1'); SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; SELECT t2.userid, MIN(t1.score+0.0) FROM t1, t2 WHERE t1.userID=t2.userID AND t1.spID=2 GROUP BY t2.userid; -drop table test.t1,test.t2; +drop table t1,t2; # # Bug in GROUP BY, by Nikki Chumakov <nikki@saddam.cityline.ru> @@ -288,7 +296,6 @@ SELECT 1 FROM t1 GROUP BY CONCAT(a, b); INSERT INTO t1 values ('hij','klm'); SELECT CONCAT(a, b),count(*) FROM t1 GROUP BY 1; DROP TABLE t1; -drop table if exists t1; # # Test problem with ORDER BY on a SUM() column diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 4f1b11c80ff..2b0a6a7be8d 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -2,7 +2,10 @@ # test of HANDLER ... # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int, b char(10), key a(a), key b(a,b)); insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 7f0a1225bda..4bd56400f98 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -1,7 +1,10 @@ # test of problems with having (Reported by Mark Rogers) # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int); select count(a) as b from t1 where a=0 having b > 0; insert into t1 values (null); diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index f8b27d09a19..cd5dbd5afbe 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/t/heap_auto_increment.test index 8a0d19d9183..6f392f6830d 100644 --- a/mysql-test/t/heap_auto_increment.test +++ b/mysql-test/t/heap_auto_increment.test @@ -2,7 +2,10 @@ # Test of auto_increment; The test for BDB tables is in bdb.test # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null auto_increment,b int, primary key (a)) type=heap auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test index 5c0002fede4..3c2ff249415 100644 --- a/mysql-test/t/heap_btree.test +++ b/mysql-test/t/heap_btree.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 5dbd2b4a928..7b375fdfa3c 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -2,7 +2,10 @@ # Test of heap tables. # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100; insert into t1 values(1,1),(2,2),(3,3),(4,4); delete from t1 where a=1 or a=0; diff --git a/mysql-test/t/innodb-deadlock.test b/mysql-test/t/innodb-deadlock.test index 2648d6cdf9c..ba4ec4a9ae4 100644 --- a/mysql-test/t/innodb-deadlock.test +++ b/mysql-test/t/innodb-deadlock.test @@ -2,7 +2,10 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); -drop table if exists t1; + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings # # Testing of FOR UPDATE @@ -36,7 +39,6 @@ select * from t1; commit; drop table t1; -drop table if exists t1, t2; # # Testing of FOR UPDATE # diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index eb5b0c9efd2..e875bf883c7 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -4,7 +4,10 @@ # Small basic test with ignore # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); @@ -664,7 +667,6 @@ DROP TABLE t1; # # Test of multi-table-update # -drop table if exists t1,t2; create table t1 (n int(10), d int(10)) type=innodb; create table t2 (n int(10), d int(10)) type=innodb; insert into t1 values(1,1),(1,2); diff --git a/mysql-test/t/innodb_cache.test b/mysql-test/t/innodb_cache.test index 9066a5f19ba..8a08c19703d 100644 --- a/mysql-test/t/innodb_cache.test +++ b/mysql-test/t/innodb_cache.test @@ -1,10 +1,14 @@ -- source include/have_innodb.inc -- source include/have_query_cache.inc +# Initialise +--disable_warnings +drop table if exists t1,t2,t3; +--enable_warnings + # # Without auto_commit. # -drop table if exists t1, t2, t3; flush status; set autocommit=0; create table t1 (a int not null) type=innodb; diff --git a/mysql-test/t/innodb_handler.test b/mysql-test/t/innodb_handler.test index 6b85be9c7ab..49178a6b6b7 100644 --- a/mysql-test/t/innodb_handler.test +++ b/mysql-test/t/innodb_handler.test @@ -4,7 +4,10 @@ # test of HANDLER ... # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int, b char(10), key a(a), key b(a,b)) type=innodb; insert into t1 values (17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"), diff --git a/mysql-test/t/ins000001.test b/mysql-test/t/ins000001.test index 4d75b4e7fe3..afcd27ebfca 100644 --- a/mysql-test/t/ins000001.test +++ b/mysql-test/t/ins000001.test @@ -1,5 +1,8 @@ use test; +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (email varchar(50)); insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'), ('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com'); diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 0bca8dc5890..bfa8aac7a1f 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -2,7 +2,10 @@ # Test of refering to old values # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int not null); insert into t1 values (1); insert into t1 values (a+2); @@ -46,15 +49,19 @@ drop table t1; create table t1 (sid char(20), id int(2) NOT NULL auto_increment, key(sid, id)); insert into t1 values ('skr',NULL),('skr',NULL),('test',NULL); select * from t1; +insert into t1 values ('rts',NULL),('rts',NULL),('test',NULL); +select * from t1; drop table t1; # # Test of mysqld crash with fully qualified column names # -drop database if exists foo; -create database foo; -use foo; +--disable_warnings +drop database if exists test_$1; +--enable_warnings +create database test_$1; +use test_$1; create table t1 (c int); -insert into foo.t1 set foo.t1.c = '1'; -drop database foo; +insert into test_$1.t1 set test_$1.t1.c = '1'; +drop database test_$1; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 42f65858d77..8fcb22e4684 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -2,7 +2,10 @@ # Problem with INSERT ... SELECT # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (bandID MEDIUMINT UNSIGNED NOT NULL PRIMARY KEY, payoutID SMALLINT UNSIGNED NOT NULL); insert into t1 (bandID,payoutID) VALUES (1,6),(2,6),(3,4),(4,9),(5,10),(6,1),(7,12),(8,12); create table t2 (payoutID SMALLINT UNSIGNED NOT NULL PRIMARY KEY); @@ -12,13 +15,13 @@ insert into t2 (payoutID) SELECT payoutID+10 FROM t1; insert ignore into t2 (payoutID) SELECT payoutID+10 FROM t1; select * from t2; drop table t1,t2; + # # bug in bulk insert optimization # test case by Fournier Jocelyn <joc@presence-pc.com> # -DROP TABLE IF EXISTS crash1,crash2; -CREATE TABLE `crash1` ( +CREATE TABLE `t1` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -34,7 +37,7 @@ CREATE TABLE `crash1` ( KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -CREATE TABLE `crash2` ( +CREATE TABLE `t2` ( `numeropost` bigint(20) unsigned NOT NULL default '0', `icone` tinyint(4) unsigned NOT NULL default '0', `numreponse` bigint(20) unsigned NOT NULL auto_increment, @@ -50,21 +53,21 @@ CREATE TABLE `crash2` ( KEY `numreponse` (`numreponse`) ) TYPE=MyISAM; -INSERT INTO crash2 +INSERT INTO t2 (numeropost,icone,numreponse,contenu,pseudo,date,ip,signature) VALUES (9,1,56,'test','joce','2001-07-25 13:50:53' ,3649052399,0); -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1618,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; show variables like '%bulk%'; -INSERT INTO crash1 (numeropost,icone,contenu,pseudo,date,signature,ip) -SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM crash2 +INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) +SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS crash1,crash2; +DROP TABLE IF EXISTS t1,t2; diff --git a/mysql-test/t/insert_update.test b/mysql-test/t/insert_update.test index 6c92774113a..f40391554cc 100644 --- a/mysql-test/t/insert_update.test +++ b/mysql-test/t/insert_update.test @@ -1,4 +1,7 @@ +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B)); INSERT t1 VALUES (1,2,10), (3,4,20); INSERT t1 VALUES (5,6,30) ON DUPLICATE KEY UPDATE c=c+100; diff --git a/mysql-test/t/isam.test b/mysql-test/t/isam.test index c7308c4b999..fc2dbac439c 100644 --- a/mysql-test/t/isam.test +++ b/mysql-test/t/isam.test @@ -1,6 +1,8 @@ -- source include/have_isam.inc +--disable_warnings drop table if exists t1,t2; +--enable_warnings # # Test possible problem with rows that are about 65535 bytes long @@ -41,10 +43,14 @@ drop table t1; # # Test of some CREATE TABLE's that should fail # -!$1121 create table t1 (a int,b text, index(a)) type=isam; -!$1073 create table t1 (a int,b text, index(b)) type=isam; -!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; -!$1121 create table t1 (ordid int(8), unique (ordid)) type=isam; +--error 1121 +create table t1 (a int,b text, index(a)) type=isam; +--error 1073 +create table t1 (a int,b text, index(b)) type=isam; +--error 1075 +create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=isam; +--error 1121 +create table t1 (ordid int(8), unique (ordid)) type=isam; drop table if exists t1; # diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test index 18006e8fd22..653b4271fe8 100644 --- a/mysql-test/t/join.test +++ b/mysql-test/t/join.test @@ -1,7 +1,9 @@ # # This failed for lia Perminov # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings create table t1 (id int primary key); create table t2 (id int); diff --git a/mysql-test/t/join_crash.test b/mysql-test/t/join_crash.test index 4606b23f726..ada6e56e664 100644 --- a/mysql-test/t/join_crash.test +++ b/mysql-test/t/join_crash.test @@ -2,7 +2,10 @@ # This test gave a core dump # +--disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4; +--enable_warnings + CREATE TABLE t1 ( project_id int(11) NOT NULL auto_increment, project_row_lock int(11) NOT NULL default '0', diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test index af5f377afb5..bfeb5bbb06b 100644 --- a/mysql-test/t/join_outer.test +++ b/mysql-test/t/join_outer.test @@ -2,7 +2,9 @@ # test of left outer join # +--disable_warnings drop table if exists t1,t2,t3,t4,t5; +--enable_warnings CREATE TABLE t1 ( grp int(11) default NULL, @@ -109,7 +111,6 @@ drop table t1,t2; # Test of LEFT JOIN with const tables (failed for frankie@etsetb.upc.es) # -drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( cod_asig int(11) DEFAULT '0' NOT NULL, desc_larga_cat varchar(80) DEFAULT '' NOT NULL, diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index 1996c793880..4fd8cc86dd5 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -2,7 +2,10 @@ # This failed for Elizabeth Mattijsen # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + CREATE TABLE t1 ( ID CHAR(32) NOT NULL, name CHAR(32) NOT NULL, @@ -173,7 +176,6 @@ drop table t1; # Problem with UNIQUE() with NULL parts and auto increment # -DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); diff --git a/mysql-test/t/key_diff.test b/mysql-test/t/key_diff.test index 60afb5f81a4..b4e4339ae33 100644 --- a/mysql-test/t/key_diff.test +++ b/mysql-test/t/key_diff.test @@ -1,7 +1,10 @@ # # Check on condition on different length keys. +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( a char(5) NOT NULL, b char(4) NOT NULL, diff --git a/mysql-test/t/key_primary.test b/mysql-test/t/key_primary.test index 2cdb117128f..816365c517c 100644 --- a/mysql-test/t/key_primary.test +++ b/mysql-test/t/key_primary.test @@ -2,7 +2,10 @@ # test of primary key conversions # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t1 char(3) primary key); insert into t1 values("ABC"); insert into t1 values("ABA"); diff --git a/mysql-test/t/keywords.test b/mysql-test/t/keywords.test index 3bd757aa069..e7ec63afe54 100644 --- a/mysql-test/t/keywords.test +++ b/mysql-test/t/keywords.test @@ -2,7 +2,10 @@ # Test keywords as fields # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (time time, date date, timestamp timestamp); insert into t1 values ("12:22:22","97:02:03","1997-01-02"); select * from t1; diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 6bcc43ac916..65d4f27059f 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -11,7 +11,10 @@ connect (con2, localhost, root,,); #remember id of con1 connection con1; +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (kill_id int); insert into t1 values(connection_id()); diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test index d4f6ce186cf..88a9831aa68 100644 --- a/mysql-test/t/limit.test +++ b/mysql-test/t/limit.test @@ -2,7 +2,10 @@ # Test of update and delete with limit # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a int primary key, b int not null); insert into t1 () values (); -- Testing default values insert into t1 values (1,1),(2,1),(3,1); diff --git a/mysql-test/t/lock.test b/mysql-test/t/lock.test index 385713174d2..0868cf2c4b1 100644 --- a/mysql-test/t/lock.test +++ b/mysql-test/t/lock.test @@ -2,7 +2,9 @@ # Testing of table locking # +--disable_warnings drop table if exists t1,t2; +--enable_warnings CREATE TABLE t1 ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY (`id`,`id2`), KEY `index_id3` (`id3`)) TYPE=MyISAM; insert into t1 (id,id2) values (1,1),(1,2),(1,3); LOCK TABLE t1 WRITE; diff --git a/mysql-test/t/lock_multi.test b/mysql-test/t/lock_multi.test index 792ae956e2a..0c6c59d0444 100644 --- a/mysql-test/t/lock_multi.test +++ b/mysql-test/t/lock_multi.test @@ -6,8 +6,11 @@ # -- source include/not_embedded.inc +--disable_warnings drop table if exists t1; -#test to see if select will get the lock ahead of low priority update +--enable_warnings + +# Test to see if select will get the lock ahead of low priority update connect (locker,localhost,root,,); connect (reader,localhost,root,,); diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index 0d04e6c7df7..f3a747c4d61 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -2,7 +2,10 @@ # Test of --lower-case-table-names # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); SELECT * FROM t1; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 39c33ef8684..f84e10b0e3c 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -2,7 +2,10 @@ # test of MERGE TABLES # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6; +--enable_warnings + create table t1 (a int not null primary key auto_increment, message char(20)); create table t2 (a int not null primary key auto_increment, message char(20)); INSERT INTO t1 (message) VALUES ("Testing"),("table"),("t1"); @@ -49,6 +52,7 @@ select * from t4; create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2); # Because of windows, it's important that we drop the merge tables first! +# This should give a warning on table t5 drop table if exists t5,t4,t3,t1,t2; create table t1 (c char(10)) type=myisam; @@ -110,10 +114,9 @@ select * from t1; drop table t1; # -# Bug found by Monty. +# Bug in flush tables combined with MERGE tables # -drop table if exists t3, t2, t1; create table t1 (a int not null, b int not null, key(a,b)); create table t2 (a int not null, b int not null, key(a,b)); create table t3 (a int not null, b int not null, key(a,b)) TYPE=MERGE UNION=(t1,t2); @@ -127,7 +130,6 @@ drop table t3,t1,t2; # [phi] testing INSERT_METHOD stuff # -drop table if exists t6, t5, t4, t3, t2, t1; # first testing of common stuff with new parameters create table t1 (a int not null, b int not null auto_increment, primary key(a,b)); create table t2 (a int not null, b int not null auto_increment, primary key(a,b)); @@ -181,15 +183,14 @@ CREATE TABLE t1 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default ' INSERT INTO t1 VALUES (1,1), (2,1); CREATE TABLE t2 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', PRIMARY KEY (a,b)) TYPE=MyISAM; INSERT INTO t2 VALUES (1,2), (2,2); -CREATE TABLE t ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); -select max(b) from t where a = 2; +CREATE TABLE t3 ( a int(11) NOT NULL default '0', b int(11) NOT NULL default '0', KEY a (a,b)) TYPE=MRG_MyISAM UNION=(t1,t2); +select max(b) from t3 where a = 2; select max(b) from t1 where a = 2; -drop table if exists t,t1,t2; +drop table if exists t3,t1,t2; # # temporary merge tables # -drop table if exists t1, t2, t3, t4, t5, t6; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -208,7 +209,6 @@ drop table if exists t6, t3, t1, t2, t4, t5; # testing merge::records_in_range and optimizer # -DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 ( fileset_id tinyint(3) unsigned NOT NULL default '0', file_code varchar(32) NOT NULL default '', @@ -235,5 +235,5 @@ EXPLAIN SELECT * FROM t1 WHERE fileset_id = 2 AND file_code BETWEEN '0000000115' AND '0000000120' LIMIT 1; EXPLAIN SELECT * FROM t2 WHERE fileset_id = 2 AND file_code = '0000000115' LIMIT 1; -DROP TABLE IF EXISTS t2, t1; +DROP TABLE t2, t1; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index ff456b710c1..6156da82ec0 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -2,7 +2,10 @@ # Test of update statement that uses many tables. # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -99,7 +102,7 @@ INSERT INTO t3 VALUES (1,'2002-02-04 00:00:00'),(3,'2002-05-12 00:00:00'),(5,'20 00:00:00'),(7,'2002-07-22 00:00:00'); delete t1,t2,t3 from t1,t2,t3 where to_days(now())-to_days(t3.mydate)>=30 and t3.id=t1.id and t3.id=t2.id; select * from t3; -DROP TABLE IF EXISTS t1,t2,t3; +DROP TABLE t1,t2,t3; CREATE TABLE IF NOT EXISTS `t1` ( `id` int(11) NOT NULL auto_increment, @@ -127,8 +130,7 @@ select * from t2; UPDATE t2, t1 SET t2.tst = t1.tst, t2.tst1 = t1.tst1 WHERE t2.ParId = t1.Id; select * from t2; - -drop table if exists t1, t2 ; +drop table t1, t2 ; create table t1 (n numeric(10)); create table t2 (n numeric(10)); @@ -213,4 +215,20 @@ insert into t2 values(1,10),(1,20); UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; select * from t1; select * from t2; +UPDATE t1 a ,t2 b SET a.d=b.d,b.d=30 WHERE a.n=b.n; +select * from t1; +select * from t2; +DELETE t1, t2 FROM t1 a,t2 b where a.n=b.n; +select * from t1; +select * from t2; drop table t1,t2; + +CREATE TABLE t1 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t1 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'),(10,''),(11,''),(12,''),(13,''); +CREATE TABLE t2 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t2 VALUES (1,'jedan'),(2,'dva'),(3,'tri'),(4,'xxxxxxxxxx'),(5,'a'); +CREATE TABLE t3 ( broj int(4) unsigned NOT NULL default '0', naziv char(25) NOT NULL default 'NEPOZNAT', PRIMARY KEY (broj)) TYPE=MyISAM; +INSERT INTO t3 VALUES (1,'jedan'),(2,'dva'); +update t1,t2 set t1.naziv="aaaa" where t1.broj=t2.broj; +update t1,t2,t3 set t1.naziv="bbbb", t2.naziv="aaaa" where t1.broj=t2.broj and t2.broj=t3.broj; +drop table t1,t2,t3; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 9c261ebf5bb..ed08b1cbacb 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -2,7 +2,15 @@ # Test bugs in the MyISAM code # -drop table if exists t1; +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +# +# Test problem with CHECK TABLE; +# + CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) @@ -82,7 +90,6 @@ DROP TABLE t1; # in ha_myisam::repair, and index size is changed (decreased). # -drop table if exists t1; create table t1 ( t1 char(255), key(t1(250))); insert t1 values ('137513751375137513751375137513751375137569516951695169516951695169516951695169'); insert t1 values ('178417841784178417841784178417841784178403420342034203420342034203420342034203'); @@ -121,7 +128,6 @@ drop table t1; # test of myisam with huge number of packed fields # -drop table if exists t1; create table t1 (i1 int, i2 int, i3 int, i4 int, i5 int, i6 int, i7 int, i8 int, i9 int, i10 int, i11 int, i12 int, i13 int, i14 int, i15 int, i16 int, i17 int, i18 int, i19 int, i20 int, i21 int, i22 int, i23 int, i24 int, i25 int, @@ -286,7 +292,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); -drop table if exists t1; +drop table t1; # # Test of REPAIR that once failed @@ -326,3 +332,23 @@ CREATE TABLE t1 (a varchar(255), b varchar(255), c varchar(255)); ALTER TABLE t1 ADD INDEX t1 (a, b, c); DROP TABLE t1; +# +# Test of cardinality of keys with NULL +# + +CREATE TABLE t1 (a int not null, b int, c int, key(b), key(c), key(a,b), key(c,a)); +INSERT into t1 values (0, null, 0), (0, null, 1), (0, null, 2), (0, null,3), (1,1,4); +create table t2 (a int not null, b int, c int, key(b), key(c), key(a)); +INSERT into t2 values (1,1,1), (2,2,2); +optimize table t1; +show index from t1; +explain select * from t1,t2 where t1.a=t2.a; +explain select * from t1,t2 force index(a) where t1.a=t2.a; +explain select * from t1 force index(a),t2 force index(a) where t1.a=t2.a; +explain select * from t1,t2 where t1.b=t2.b; +explain select * from t1,t2 force index(c) where t1.a=t2.a; +explain select * from t1 where a=0 or a=2; +explain select * from t1 force index (a) where a=0 or a=2; +explain select * from t1 where c=1; +explain select * from t1 use index() where c=1; +drop table t1,t2; diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index ad32e0be6ff..087ef81e13e 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Testing of NULL in a lot of different places # @@ -15,7 +20,6 @@ SELECT (NULL OR NULL) IS NULL; select NULL AND 0, 0 and NULL; select inet_ntoa(null),inet_aton(null),inet_aton("122.256"),inet_aton("122.226."),inet_aton(""); -drop table if exists t1; create table t1 (x int); insert into t1 values (null); select * from t1 where x != 0; diff --git a/mysql-test/t/null_key.test b/mysql-test/t/null_key.test index b1cbd5cdfb0..18d0d368891 100644 --- a/mysql-test/t/null_key.test +++ b/mysql-test/t/null_key.test @@ -1,7 +1,10 @@ # # Check null keys -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam; insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6); explain select * from t1 where a is null; @@ -51,7 +54,6 @@ drop table t1; # The following failed for Matt Loschert # -DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 ( id int(10) unsigned NOT NULL auto_increment, uniq_id int(10) unsigned default NULL, diff --git a/mysql-test/t/odbc.test b/mysql-test/t/odbc.test index 3e0fc214d3e..9aac5948359 100644 --- a/mysql-test/t/odbc.test +++ b/mysql-test/t/odbc.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # Test some ODBC compatibility # @@ -8,7 +13,6 @@ select {fn length("hello")}, { date "1997-10-20" }; # Test retreiving row with last insert_id value. # -drop table if exists t1; create table t1 (a int not null auto_increment,b int not null,primary key (a,b)); insert into t1 SET A=NULL,B=1; insert into t1 SET a=null,b=2; diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 8fe547db615..99bb2656001 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -1,6 +1,9 @@ -drop table if exists sales; -create table sales ( product varchar(32), country varchar(32), year int, profit int); -insert into sales values ( 'Computer', 'India',2000, 1200), +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 ( product varchar(32), country varchar(32), year int, profit int); +insert into t1 values ( 'Computer', 'India',2000, 1200), ( 'TV', 'United States', 1999, 150), ( 'Calculator', 'United States', 1999,50), ( 'Computer', 'United States', 1999,1500), @@ -15,13 +18,14 @@ insert into sales values ( 'Computer', 'India',2000, 1200), ( 'Computer', 'United States', 2000,1500), ( 'Calculator', 'United States', 2000,75); --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with cube; +select product, country , year, sum(profit) from t1 group by product, country, year with cube; --error 1235 -explain select product, country , year, sum(profit) from sales group by product, country, year with cube; +explain select product, country , year, sum(profit) from t1 group by product, country, year with cube; --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with rollup; +select product, country , year, sum(profit) from t1 group by product, country, year with rollup; --error 1235 -explain select product, country , year, sum(profit) from sales group by product, country, year with rollup; +explain select product, country , year, sum(profit) from t1 group by product, country, year with rollup; --error 1235 -select product, country , year, sum(profit) from sales group by product, country, year with cube union all select product, country , year, sum(profit) from sales group by product, country, year with rollup; -drop table sales; +select product, country , year, sum(profit) from t1 group by product, country, year with cube union all select product, country , year, sum(profit) from t1 group by product, country, year with rollup; +drop table t1; + diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 0ee6f901aae..c6bc7e9f868 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2,7 +2,9 @@ # Bug with order by # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 ( id int(6) DEFAULT '0' NOT NULL, @@ -168,7 +170,6 @@ drop table t1,t2,t3; #bug reported by Wouter de Jong -drop table if exists t1; CREATE TABLE t1 ( member_id int(11) NOT NULL auto_increment, inschrijf_datum varchar(20) NOT NULL default '', @@ -330,3 +331,24 @@ INSERT INTO t2 (numeropost,pseudo) VALUES (1,'joce'),(1,'bug'); SELECT titre,t1.numeropost,auteur,icone,nbrep,0,date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30; SELECT titre,t1.numeropost,auteur,icone,nbrep,'0',date,vue,ouvert,lastauteur,dest FROM t2 LEFT JOIN t1 USING(numeropost) WHERE t2.pseudo='joce' ORDER BY date DESC LIMIT 0,30; drop table t1,t2; + +# +# Test of test_if_subkey() function +# + +CREATE TABLE t1 ( + FieldKey varchar(36) NOT NULL default '', + LongVal bigint(20) default NULL, + StringVal mediumtext, + KEY FieldKey (FieldKey), + KEY LongField (FieldKey,LongVal), + KEY StringField (FieldKey,StringVal(32)) +); +INSERT INTO t1 VALUES ('0',3,'0'),('0',2,'1'),('0',1,'2'),('1',2,'1'),('1',1,'3'), ('1',0,'2'),('2',3,'0'),('2',2,'1'),('2',1,'2'),('3',2,'1'),('3',1,'2'),('3','3','3'); +EXPLAIN SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey = '1' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY LongVal; +EXPLAIN SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +SELECT * FROM t1 WHERE FieldKey > '2' ORDER BY FieldKey, LongVal; +DROP TABLE t1; diff --git a/mysql-test/t/order_fill_sortbuf.test b/mysql-test/t/order_fill_sortbuf.test index 6419f2a93df..37620ebe331 100644 --- a/mysql-test/t/order_fill_sortbuf.test +++ b/mysql-test/t/order_fill_sortbuf.test @@ -3,7 +3,10 @@ # rows MySQL needs to use a merge during the sort phase. # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE `t1` ( `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test index c126d221bd2..a944df01051 100644 --- a/mysql-test/t/outfile.test +++ b/mysql-test/t/outfile.test @@ -21,3 +21,8 @@ #select * into dumpfile "/tmp/select-test.99" from t1; #select load_file("/tmp/select-test.not-exist"); #drop table t1; +#drop table if exists t; +#CREATE TABLE t ( t timestamp NOT NULL, c char(200) character set latin1 NOT NULL default '', i int(11), v varchar(200), b blob, KEY t (t)) TYPE=MyISAM; +#INSERT INTO t VALUES ('2002-12-20 12:01:20','',1,"aaa","bbb"); +#select * from t into outfile "check"; +#drop table if exists t; diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test new file mode 100644 index 00000000000..5c4e7efcaf3 --- /dev/null +++ b/mysql-test/t/packet.test @@ -0,0 +1,31 @@ + +# +# Check protocol handling +# + +connect (con1,localhost,root,,); + +connection con1; +set global max_allowed_packet=100; +set max_allowed_packet=100; +set global net_buffer_length=100; +set net_buffer_length=100; +# Have to be > 1024 as min value of net_buffer_length is 1024 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +# Should return NULL as 200 is bigger than max_allowed_packet +select repeat('a',200); + +# +# Connection 2 should get error for too big packets +# +connect (con2,localhost,root,,); +connection con2; +select @@net_buffer_length, @@max_allowed_packet; +--error 1153 +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +set global max_allowed_packet=default; +set max_allowed_packet=default; +set global net_buffer_length=default; +set net_buffer_length=default; +SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len; +select length(repeat('a',200)); diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test index 6c3f3d6ac52..e1df5fa7b3b 100644 --- a/mysql-test/t/query_cache.test +++ b/mysql-test/t/query_cache.test @@ -10,7 +10,10 @@ flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; flush status; +--disable_warnings +drop database if exists mysqltest; drop table if exists t1,t2,t3,t11,t21, mysqltest.t1; +--enable_warnings # # First simple test @@ -368,6 +371,7 @@ select * from t2; show status like "Qcache_queries_in_cache"; select * from t3; show status like "Qcache_queries_in_cache"; +update t1 set i=(select distinct 1 from (select * from t2) a); drop table t1, t2, t3; # diff --git a/mysql-test/t/raid.test b/mysql-test/t/raid.test index 8b608c1069f..38c740201bc 100644 --- a/mysql-test/t/raid.test +++ b/mysql-test/t/raid.test @@ -5,7 +5,10 @@ show variables like "have_raid"; # Test of raided tables # +--disable_warnings DROP TABLE IF EXISTS t1,t2; +--enable_warnings + CREATE TABLE t1 ( id int unsigned not null auto_increment primary key, c char(255) not null diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 278807eeea4..31b3ced6cc6 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -2,7 +2,10 @@ # Problem med range optimizer # +--disable_warnings drop table if exists t1; +--enable_warnings + CREATE TABLE t1 ( event_date date DEFAULT '0000-00-00' NOT NULL, type int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/rename.test b/mysql-test/t/rename.test index ce4651d8de3..48a9cb401d9 100644 --- a/mysql-test/t/rename.test +++ b/mysql-test/t/rename.test @@ -2,7 +2,10 @@ # Test of rename table # +--disable_warnings drop table if exists t0,t1,t2,t3,t4; +--enable_warnings + create table t0 SELECT 1,"table 1"; create table t2 SELECT 2,"table 2"; create table t3 SELECT 3,"table 3"; @@ -29,4 +32,6 @@ rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1; select * from t1; select * from t2; select * from t3; + +# This should give a warning for t4 drop table if exists t1,t2,t3,t4; diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test index 6d79014b23d..bdc5a57a07c 100644 --- a/mysql-test/t/repair.test +++ b/mysql-test/t/repair.test @@ -2,7 +2,10 @@ # Test of repair table # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 SELECT 1,"table 1"; repair table t1 use_frm; drop table if exists t1; diff --git a/mysql-test/t/replace.test b/mysql-test/t/replace.test index e9e01615a62..7aeb2475ab5 100644 --- a/mysql-test/t/replace.test +++ b/mysql-test/t/replace.test @@ -4,7 +4,9 @@ # Test of REPLACE with ISAM and MyISAM and HEAP # +--disable_warnings drop table if exists t1; +--enable_warnings CREATE TABLE t1 ( gesuchnr int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test index bd37e69ae23..1673f1648d3 100644 --- a/mysql-test/t/rollback.test +++ b/mysql-test/t/rollback.test @@ -2,7 +2,9 @@ # This test should fail as MyISAM doesn't have rollback # +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (n int not null primary key) type=myisam; begin work; diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 593e2342856..099eaa95c77 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + select row(1,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3)); select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3)); @@ -33,7 +38,7 @@ SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3)); SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)); -- error 1239 SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); -drop table if exists t1; + create table t1 ( a int, b int, c int); insert into t1 values (1,2,3), (2,3,1), (3,2,1), (1,2,NULL); select * from t1 where ROW(1,2,3)=ROW(a,b,c); @@ -47,7 +52,7 @@ drop table t1; -- error 1239 select ROW(1,1); -drop table if exists t1; + create table t1 (i int); -- error 1239 select 1 from t1 where ROW(1,1); diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test index ce6897e63e1..3975f14e523 100644 --- a/mysql-test/t/rpl000001.test +++ b/mysql-test/t/rpl000001.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1,t2,t3; + create table t1 (word char(20) not null); load data infile '../../std_data/words.dat' into table t1; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test index 5fabe0d2c59..803eb069b66 100644 --- a/mysql-test/t/rpl000002.test +++ b/mysql-test/t/rpl000002.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + create table t1 (n int auto_increment primary key); set insert_id = 2000; insert into t1 values (NULL),(NULL),(NULL); @@ -12,7 +12,6 @@ drop table t1; sync_slave_with_master; stop slave; connection master; -drop table if exists t2; create table t2(id int auto_increment primary key, created datetime); set timestamp=12345; insert into t2 set created=now(); diff --git a/mysql-test/t/rpl000003.test b/mysql-test/t/rpl000003.test deleted file mode 100644 index f994ed94371..00000000000 --- a/mysql-test/t/rpl000003.test +++ /dev/null @@ -1,14 +0,0 @@ -source include/master-slave.inc; -drop table if exists t1; -create table t1(n int primary key); -!insert into t1 values (1),(2),(2); -insert into t1 values (3); -save_master_pos; -connection slave; -sync_with_master; -select * from t1; -connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; diff --git a/mysql-test/t/rpl000004.test b/mysql-test/t/rpl000004.test index 705e0d51b7b..8fc2977faab 100644 --- a/mysql-test/t/rpl000004.test +++ b/mysql-test/t/rpl000004.test @@ -1,18 +1,14 @@ source include/master-slave.inc; + set SQL_LOG_BIN=0; -drop table if exists t1; create table t1 (word char(20) not null, index(word)); load data infile '../../std_data/words.dat' into table t1; -drop table if exists t2; create table t2 (word char(20) not null); load data infile '../../std_data/words.dat' into table t2; create table t3 (word char(20) not null primary key); connection slave; -drop table if exists t1; load table t1 from master; -drop table if exists t2; load table t2 from master; -drop table if exists t3; load table t3 from master; check table t1; select count(*) from t2; diff --git a/mysql-test/t/rpl000005.test b/mysql-test/t/rpl000005.test index 1cfea242b69..ae713633df3 100644 --- a/mysql-test/t/rpl000005.test +++ b/mysql-test/t/rpl000005.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + CREATE TABLE t1 (name varchar(64), age smallint(3)); INSERT INTO t1 SET name='Andy', age=31; INSERT t1 SET name='Jacob', age=2; diff --git a/mysql-test/t/rpl000006.test b/mysql-test/t/rpl000006.test index ad8622c2a81..c6438062bb7 100644 --- a/mysql-test/t/rpl000006.test +++ b/mysql-test/t/rpl000006.test @@ -5,12 +5,10 @@ source include/master-slave.inc; # Don't log table creating to the slave as we want to test LOAD TABLE set SQL_LOG_BIN=0,timestamp=200006; -drop table if exists t1; create table t1(t timestamp not null,a char(1)); insert into t1 ( a) values ('F'); select unix_timestamp(t) from t1; connection slave; -drop table if exists t1; load table t1 from master; select unix_timestamp(t) from t1; diff --git a/mysql-test/t/rpl000008-slave.opt b/mysql-test/t/rpl000008-slave.opt index 79b3bf6174b..177f89e0910 100644 --- a/mysql-test/t/rpl000008-slave.opt +++ b/mysql-test/t/rpl000008-slave.opt @@ -1 +1 @@ ---replicate-ignore-table=test.foo +--replicate-ignore-table=test.mysqltest_foo diff --git a/mysql-test/t/rpl000008.test b/mysql-test/t/rpl000008.test index 12760008b6d..ea782b99d28 100644 --- a/mysql-test/t/rpl000008.test +++ b/mysql-test/t/rpl000008.test @@ -1,29 +1,36 @@ -#this one assumes we are ignoring updates on table foo, but doing -#the ones on all other tables +# This one assumes we are ignoring updates on table mysqltest_foo, but doing +# the ones on all other tables + source include/master-slave.inc; connection slave; + +# +# For this test we must be in the test database +# use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(4); + +--disable_warnings +drop table if exists mysqltest_foo; +drop table if exists mysqltest_bar; +--enable_warnings + +create table mysqltest_foo (n int); +insert into mysqltest_foo values(4); connection master; use test; -drop table if exists foo; -create table foo (n int); -insert into foo values(5); -drop table if exists bar; -create table bar (m int); -insert into bar values(15); -drop table if exists choo; -create table choo (k int); -insert into choo values(55); +create table mysqltest_foo (n int); +insert into mysqltest_foo values(5); +create table mysqltest_bar (m int); +insert into mysqltest_bar values(15); +create table t1 (k int); +insert into t1 values(55); save_master_pos; connection slave; sync_with_master; -select foo.n,bar.m,choo.k from foo,bar,choo; +select mysqltest_foo.n,mysqltest_bar.m,t1.k from mysqltest_foo,mysqltest_bar,t1; connection master; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; save_master_pos; connection slave; sync_with_master; -drop table if exists foo,bar,choo; +drop table mysqltest_foo,mysqltest_bar,t1; diff --git a/mysql-test/t/rpl000009-slave.opt b/mysql-test/t/rpl000009-slave.opt index 245e310c5d8..c015c02ba78 100644 --- a/mysql-test/t/rpl000009-slave.opt +++ b/mysql-test/t/rpl000009-slave.opt @@ -1 +1 @@ ---replicate-wild-do-table=bar.% +--replicate-wild-do-table=mysqltest.% diff --git a/mysql-test/t/rpl000009.test b/mysql-test/t/rpl000009.test index 3d0827718ec..d5cb14350a6 100644 --- a/mysql-test/t/rpl000009.test +++ b/mysql-test/t/rpl000009.test @@ -1,36 +1,34 @@ -# This one assumes we are ignoring updates on tables in database foo, but doing -# the ones in database bar +# This one assumes we are ignoring updates on tables in database mysqltest2, +# but doing the ones in database mysqltest source include/master-slave.inc; -drop database if exists foo; -create database foo; -drop database if exists bar; -create database bar; +--disable_warnings +drop database if exists mysqltest2; +create database mysqltest2; +drop database if exists mysqltest; +create database mysqltest; +--enable_warnings + save_master_pos; connection slave; sync_with_master; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(4); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(4); connection master; -drop table if exists foo.foo; -create table foo.foo (n int); -insert into foo.foo values(5); -drop table if exists bar.bar; -create table bar.bar (m int); -insert into bar.bar values(15); +create table mysqltest2.foo (n int); +insert into mysqltest2.foo values(5); +create table mysqltest.bar (m int); +insert into mysqltest.bar values(15); save_master_pos; connection slave; sync_with_master; -select foo.foo.n,bar.bar.m from foo.foo,bar.bar; +select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar; connection master; -drop database if exists bar; -drop database if exists foo; +drop database mysqltest; +drop database mysqltest2; save_master_pos; connection slave; sync_with_master; -drop database if exists bar; -drop database if exists foo; # Now let's test load data from master @@ -38,19 +36,19 @@ drop database if exists foo; connection master; set sql_log_bin = 0; -create database foo; -create database bar; +create database mysqltest2; +create database mysqltest; show databases; -create table foo.t1(n int, s char(20)); -create table foo.t2(n int, s text); -insert into foo.t1 values (1, 'one'), (2, 'two'), (3, 'three'); -insert into foo.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); +create table mysqltest2.t1(n int, s char(20)); +create table mysqltest2.t2(n int, s text); +insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three'); +insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'); -create table bar.t1(n int, s char(20)); -create table bar.t2(n int, s text); -insert into bar.t1 values (1, 'one bar'), (2, 'two bar'), (3, 'three bar'); -insert into bar.t2 values (11, 'eleven bar'), (12, 'twelve bar'), - (13, 'thirteen bar'); +create table mysqltest.t1(n int, s char(20)); +create table mysqltest.t2(n int, s text); +insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test'); +insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'), + (13, 'thirteen test'); set sql_log_bin = 1; save_master_pos; connection slave; @@ -62,26 +60,25 @@ load data from master; # Now let's check if we have the right tables and the right data in them show databases; -use foo; +use mysqltest2; show tables; -use bar; +use mysqltest; show tables; -select * from bar.t1; -select * from bar.t2; +select * from mysqltest.t1; +select * from mysqltest.t2; # Now let's see if replication works connection master; -insert into bar.t1 values (4, 'four bar'); +insert into mysqltest.t1 values (4, 'four test'); save_master_pos; connection slave; sync_with_master; -select * from bar.t1; +select * from mysqltest.t1; # Now time for cleanup connection master; -drop database bar; -drop database foo; +drop database mysqltest; +drop database mysqltest2; save_master_pos; connection slave; sync_with_master; - diff --git a/mysql-test/t/rpl000010.test b/mysql-test/t/rpl000010.test index 05a211fbd85..0725214694a 100644 --- a/mysql-test/t/rpl000010.test +++ b/mysql-test/t/rpl000010.test @@ -1,10 +1,8 @@ -#this tests the offset off by 22 mystery bug -#must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 +# This tests the offset off by 22 mystery bug +# Must run slave with --disconnect-slave-event-count=1 --master-connect-retry=1 + source include/master-slave.inc; -connection slave; -drop table if exists t1; -connection master; -drop table if exists t1; + create table t1 (n int not null auto_increment primary key); insert into t1 values(NULL); insert into t1 values(2); diff --git a/mysql-test/t/rpl000011.test b/mysql-test/t/rpl000011.test index dc84741694c..3b00afe10e4 100644 --- a/mysql-test/t/rpl000011.test +++ b/mysql-test/t/rpl000011.test @@ -1,5 +1,5 @@ source include/master-slave.inc; -drop table if exists t1; + create table t1 (n int); insert into t1 values(1); sync_slave_with_master; diff --git a/mysql-test/t/rpl000012.test b/mysql-test/t/rpl000012.test index 9f8ba9a4f91..7f440eaaa13 100644 --- a/mysql-test/t/rpl000012.test +++ b/mysql-test/t/rpl000012.test @@ -1,18 +1,16 @@ source include/master-slave.inc; connection master; -drop table if exists t1,t2,t3; create table t2 (n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); insert into t2 select * from t1; -drop table if exists test.t3; -create temporary table test.t3 (n int not null); -alter table test.t3 add primary key(n); +create temporary table t3 (n int not null); +alter table t3 add primary key(n); flush logs; insert into t3 values (100); insert into t2 select * from t3; -drop table if exists test.t3; +drop table if exists t3; insert into t2 values (101); connection master1; create temporary table t1 (n int); diff --git a/mysql-test/t/rpl000013.test b/mysql-test/t/rpl000013.test index 14619796e01..94d5feb3925 100644 --- a/mysql-test/t/rpl000013.test +++ b/mysql-test/t/rpl000013.test @@ -3,7 +3,7 @@ save_master_pos; connection slave; sync_with_master; connection master; -drop table if exists t2; + create table t2(n int); create temporary table t1 (n int); insert into t1 values(1),(2),(3); @@ -31,6 +31,10 @@ show status like 'Slave_open_temp_tables'; # connect (master2,localhost,root,,); connection master2; + +# We will get a warning for t1 as this is a temporary table that doesn't +# exist in this connection. + drop table if exists t1,t2; save_master_pos; connection slave; diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test index 37155d33f08..9573dfd8fb3 100644 --- a/mysql-test/t/rpl000015.test +++ b/mysql-test/t/rpl000015.test @@ -23,7 +23,9 @@ sync_with_master; --replace_result $MASTER_MYPORT MASTER_PORT show slave status; connection master; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (n int); insert into t1 values (10),(45),(90); sync_slave_with_master; diff --git a/mysql-test/t/rpl000016-slave.opt b/mysql-test/t/rpl000016-slave.opt deleted file mode 100644 index f27601e0d7d..00000000000 --- a/mysql-test/t/rpl000016-slave.opt +++ /dev/null @@ -1 +0,0 @@ --O max_binlog_size=2048 diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test index 3bff9b4cbd8..f38e109cb19 100644 --- a/mysql-test/t/rpl000017.test +++ b/mysql-test/t/rpl000017.test @@ -7,7 +7,9 @@ grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaa connection slave; start slave; connection master; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int); insert into t1 values(24); sync_slave_with_master; diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test index e992f7938eb..b8c09ed431d 100644 --- a/mysql-test/t/rpl000018.test +++ b/mysql-test/t/rpl000018.test @@ -13,7 +13,9 @@ reset slave; start slave; connection master; show binary logs; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(n int); insert into t1 values (3351); sync_slave_with_master; diff --git a/mysql-test/t/rpl_alter.test b/mysql-test/t/rpl_alter.test index 710dd2d09d6..6b8cf773150 100644 --- a/mysql-test/t/rpl_alter.test +++ b/mysql-test/t/rpl_alter.test @@ -1,19 +1,22 @@ source include/master-slave.inc; -drop database if exists d1; -create database d1; -create table d1.t1 ( n int); -alter table d1.t1 add m int; -insert into d1.t1 values (1,2); -create table d1.t2 (n int); -insert into d1.t2 values (45); -rename table d1.t2 to d1.t3, d1.t1 to d1.t2; +--disable_warnings +drop database if exists test_$1; +--enable_warnings +create database test_$1; + +create table test_$1.t1 ( n int); +alter table test_$1.t1 add m int; +insert into test_$1.t1 values (1,2); +create table test_$1.t2 (n int); +insert into test_$1.t2 values (45); +rename table test_$1.t2 to test_$1.t3, test_$1.t1 to test_$1.t2; save_master_pos; connection slave; sync_with_master; -select * from d1.t2; -select * from d1.t3; +select * from test_$1.t2; +select * from test_$1.t3; connection master; -drop database d1; +drop database test_$1; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/rpl_empty_master_crash.test b/mysql-test/t/rpl_empty_master_crash.test index afa76ce10bb..9d5a7a173b0 100644 --- a/mysql-test/t/rpl_empty_master_crash.test +++ b/mysql-test/t/rpl_empty_master_crash.test @@ -1,6 +1,7 @@ source include/master-slave.inc; -drop table if exists t1; + show slave status; + # # Load table should not succeed on the master as this is not a slave # diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index d320796edd3..bc1349a959a 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -6,7 +6,9 @@ show master status; sync_slave_with_master; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; +stop slave; change master to master_log_pos=73; +start slave; sleep 5; stop slave; @@ -17,6 +19,7 @@ start slave; sleep 5; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT show slave status; +stop slave; change master to master_log_pos=173; --replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT start slave; @@ -31,6 +34,7 @@ create table t1 (n int); insert into t1 values (1),(2),(3); save_master_pos; connection slave; +stop slave; change master to master_log_pos=79; start slave; sync_with_master; diff --git a/mysql-test/t/rpl_redirect.test b/mysql-test/t/rpl_redirect.test index 4082542f295..181d200b761 100644 --- a/mysql-test/t/rpl_redirect.test +++ b/mysql-test/t/rpl_redirect.test @@ -19,7 +19,6 @@ rpl_probe; #turn on master/slave query direction auto-magic enable_rpl_parse; -drop table if exists t1; create table t1 ( n int); insert into t1 values (1),(2),(3),(4); disable_rpl_parse; diff --git a/mysql-test/t/rpl_replicate_do.test b/mysql-test/t/rpl_replicate_do.test index 0800062dc05..dcb3c5034fd 100644 --- a/mysql-test/t/rpl_replicate_do.test +++ b/mysql-test/t/rpl_replicate_do.test @@ -2,9 +2,12 @@ # updates on t1 source include/master-slave.inc; +--disable_warnings drop table if exists t11; connection slave; drop table if exists t11; +--enable_warnings + create table t2 (n int); insert into t2 values(4); connection master; @@ -24,7 +27,7 @@ select * from t2; --error 1146 select * from t11; connection master; -drop table if exists t1,t2,t3,t11; +drop table if exists t1,t2,t11; save_master_pos; connection slave; sync_with_master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index c552936d93f..025e07382ba 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -1,5 +1,5 @@ # -# Test are run with max_binlog_size=2048 to force automatic rotation of the +# Test is run with max_binlog_size=2048 to force automatic rotation of the # binary log # Tests done: # - Check that slaves reports correct failures if master.info has strange @@ -8,14 +8,18 @@ # - Ensure that temporary tables works over flush logs and binary log # changes # - Test creating a duplicate key error and recover from it -# + connect (master,localhost,root,,test,0,master.sock); +--disable_warnings drop table if exists t1, t2, t3, t4; +--enable_warnings connect (slave,localhost,root,,test,0,slave.sock); system cat /dev/null > var/slave-data/master.info; system chmod 000 var/slave-data/master.info; connection slave; +--disable_warnings drop table if exists t1, t2, t3, t4; +--enable_warnings --error 1201 start slave; system chmod 600 var/slave-data/master.info; @@ -46,7 +50,6 @@ show slave status; select * from t1; connection master; flush logs; -drop table if exists t2; create table t2(m int not null auto_increment primary key); insert into t2 values (34),(67),(123); flush logs; @@ -102,7 +105,7 @@ connection master; create temporary table temp_table (a char(80) not null); insert into temp_table values ("testing temporary tables part 2"); let $1=100; -drop table if exists t3; + create table t3 (n int); disable_query_log; while ($1) diff --git a/mysql-test/t/rpl_skip_error.test b/mysql-test/t/rpl_skip_error.test index d43c59ef024..86c89c70314 100644 --- a/mysql-test/t/rpl_skip_error.test +++ b/mysql-test/t/rpl_skip_error.test @@ -1,5 +1,4 @@ source include/master-slave.inc; -drop table if exists t1; create table t1 (n int not null primary key); save_master_pos; diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test new file mode 100644 index 00000000000..75519b75f75 --- /dev/null +++ b/mysql-test/t/rpl_temporary.test @@ -0,0 +1,79 @@ +source include/master-slave.inc; + +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); + +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +create table t1(f int); +create table t2(f int); +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +connection con1; +create temporary table t3(f int); +insert into t3 select * from t1 where f<6; +sleep 1; + +connection con2; +create temporary table t3(f int); +sleep 1; + +connection con1; +insert into t2 select count(*) from t3; +sleep 1; + +connection con2; +insert into t3 select * from t1 where f>=4; +sleep 1; + +connection con1; +drop temporary table t3; +sleep 1; + +connection con2; +insert into t2 select count(*) from t3; +drop temporary table t3; + +select * from t2; + +show binlog events; + +drop table t1, t2; + +use test; +SET TIMESTAMP=1040323920; +create table t1(f int); +SET TIMESTAMP=1040323931; +create table t2(f int); +SET TIMESTAMP=1040323938; +insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +SET TIMESTAMP=1040323945; +SET @@session.pseudo_thread_id=1; +create temporary table t3(f int); +SET TIMESTAMP=1040323952; +SET @@session.pseudo_thread_id=1; +insert into t3 select * from t1 where f<6; +SET TIMESTAMP=1040324145; +SET @@session.pseudo_thread_id=2; +create temporary table t3(f int); +SET TIMESTAMP=1040324186; +SET @@session.pseudo_thread_id=1; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324200; +SET @@session.pseudo_thread_id=2; +insert into t3 select * from t1 where f>=4; +SET TIMESTAMP=1040324211; +SET @@session.pseudo_thread_id=1; +drop temporary table t3; +SET TIMESTAMP=1040324219; +SET @@session.pseudo_thread_id=2; +insert into t2 select count(*) from t3; +SET TIMESTAMP=1040324224; +SET @@session.pseudo_thread_id=2; +drop temporary table t3; + +select * from t2; +drop table t1,t2; diff --git a/mysql-test/t/sel000001.test b/mysql-test/t/sel000001.test deleted file mode 100644 index 77355f8d535..00000000000 --- a/mysql-test/t/sel000001.test +++ /dev/null @@ -1,18 +0,0 @@ -# sel000001 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# Testing WHERE clause. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (s CHAR(20) PRIMARY KEY, id INT); -INSERT INTO t1 VALUES ('cat', 1), ('mouse', 3), ('dog', 2), ('snake', 77); -SELECT s, id FROM t1 WHERE s = 'mouse'; -drop table t1; diff --git a/mysql-test/t/sel000002.test b/mysql-test/t/sel000002.test deleted file mode 100644 index 9a89db2821c..00000000000 --- a/mysql-test/t/sel000002.test +++ /dev/null @@ -1,17 +0,0 @@ -# sel000002 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (n INT); -INSERT INTO t1 VALUES (1), (2), (3); -SELECT * FROM t1; -drop table t1; diff --git a/mysql-test/t/sel000003.test b/mysql-test/t/sel000003.test deleted file mode 100644 index a3f6a7337c2..00000000000 --- a/mysql-test/t/sel000003.test +++ /dev/null @@ -1,18 +0,0 @@ -# sel000003 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# This test is just a simple select. -# Testing count() function and GROUP BY clause. -# - -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (name CHAR(20) NOT NULL PRIMARY KEY, score SMALLINT NOT NULL, KEY(score)); -INSERT INTO t1 VALUES ('Sasha', 20), ('Matt', 20), ('Monty', 10), ('David', 10), ('Tim', 10), ('Jeremy', 10); -SELECT COUNT(*) as n, score FROM t1 GROUP BY score; -drop table t1; diff --git a/mysql-test/t/sel000031.test b/mysql-test/t/sel000031.test deleted file mode 100644 index 29bafbb3040..00000000000 --- a/mysql-test/t/sel000031.test +++ /dev/null @@ -1,20 +0,0 @@ -# sel000031 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# test for a bug with elt() and order by - -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); - -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; -drop table t1,t2; diff --git a/mysql-test/t/sel000032.test b/mysql-test/t/sel000032.test deleted file mode 100644 index d31ba69e9d8..00000000000 --- a/mysql-test/t/sel000032.test +++ /dev/null @@ -1,20 +0,0 @@ -# sel000032 -# -# Versions -# -------- -# 3.22 -# 3.23 -# -# Description -# ----------- -# test for a bug with elt() - -drop table if exists t1,t2; -create table t1 (id int(10) not null unique); -create table t2 (id int(10) not null primary key, -val int(10) not null); -insert into t1 values (1),(2),(4); -insert into t2 values (1,1),(2,1),(3,1),(4,2); - -select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; -drop table t1,t2; diff --git a/mysql-test/t/sel000033.test b/mysql-test/t/sel000033.test index 165e43ad9f8..72e096311ce 100644 --- a/mysql-test/t/sel000033.test +++ b/mysql-test/t/sel000033.test @@ -9,7 +9,9 @@ # ----------- # test for a bug with in() and unique key +--disable_warnings drop table if exists t1; +--enable_warnings create table t1 (id int(10) primary key); insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9); diff --git a/mysql-test/t/sel000100.test b/mysql-test/t/sel000100.test index cedb78b17e7..2f9c06d5cf4 100644 --- a/mysql-test/t/sel000100.test +++ b/mysql-test/t/sel000100.test @@ -1,4 +1,6 @@ +--disable_warnings DROP TABLE IF EXISTS t1,t2; +--enable_warnings CREATE TABLE t1 ( ID int(11) NOT NULL auto_increment, diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 7ea86845cb0..d4effd2026c 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -6,9 +6,9 @@ # Simple select test # -use test; - +--disable_warnings drop table if exists t1,t2,t3,t4; +--enable_warnings CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -1489,8 +1489,6 @@ select t2.fld1,fld3,period,price,price2 from t2,t3 where t2.fld1>= 18201 and t2. # We need another table for join stuff.. # -drop table if exists company; - create table t4 ( companynr tinyint(2) unsigned zerofill NOT NULL default '00', companyname char(30) NOT NULL default '', @@ -1800,10 +1798,10 @@ select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a)); select * from t1 natural join (t1 as t2 left join t1 as t3 using (a)); select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1; drop table t1; -drop table if exists t1,t2; + CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; -drop table if exists t1,t2; +drop table t1,t2; diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test index fb57224dd19..06624d50a43 100644 --- a/mysql-test/t/select_found.test +++ b/mysql-test/t/select_found.test @@ -1,8 +1,10 @@ # # Testing of found_rows() # - +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int not null auto_increment, b int not null, primary key(a)); insert into t1 (b) values (2),(3),(5),(5),(5),(6),(7),(9); select SQL_CALC_FOUND_ROWS * from t1; diff --git a/mysql-test/t/select_safe.test b/mysql-test/t/select_safe.test index e76b7558997..cd8bce6369c 100644 --- a/mysql-test/t/select_safe.test +++ b/mysql-test/t/select_safe.test @@ -2,7 +2,10 @@ # test of safe selects # +--disable_warnings drop table if exists t1; +--enable_warnings + SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9; create table t1 (a int primary key, b char(20)); insert into t1 values(1,"test"); diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index eb15eac8bad..a21436637d1 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -2,7 +2,10 @@ # Test of some show commands # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); check table t1 fast; diff --git a/mysql-test/t/status.test b/mysql-test/t/status.test index cffca437cf1..90d7f814359 100644 --- a/mysql-test/t/status.test +++ b/mysql-test/t/status.test @@ -13,7 +13,10 @@ flush status; show status like 'Table_lock%'; connection con1; SET SQL_LOG_BIN=0; +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1(n int) type=myisam; insert into t1 values(1); connection con2; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 0527d6a2001..1dcbd9a282d 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -1,6 +1,14 @@ +# Initialise +--disable_warnings +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t11,t12; +--enable_warnings + select (select 2); +explain select (select 2); SELECT (SELECT 1) UNION SELECT (SELECT 2); +explain SELECT (SELECT 1) UNION SELECT (SELECT 2); SELECT (SELECT (SELECT 0 UNION SELECT 0)); +explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); -- error 1245 SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; -- error 1245 @@ -15,7 +23,7 @@ SELECT (SELECT 1), a; SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; -- error 1054 SELECT 1 FROM (SELECT (SELECT a) b) c; -SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id LIMIT 1); +SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); -- error 1239 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); SELECT 1 IN (SELECT 1); @@ -26,8 +34,23 @@ select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1)); SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1)); SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL; SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL; +SELECT (SELECT 1,2,3) = ROW(1,2,3); +SELECT (SELECT 1,2,3) = ROW(1,2,1); +SELECT (SELECT 1,2,3) < ROW(1,2,1); +SELECT (SELECT 1,2,3) > ROW(1,2,1); +SELECT (SELECT 1,2,3) = ROW(1,2,NULL); +SELECT ROW(1,2,3) = (SELECT 1,2,3); +SELECT ROW(1,2,3) = (SELECT 1,2,1); +SELECT ROW(1,2,3) < (SELECT 1,2,1); +SELECT ROW(1,2,3) > (SELECT 1,2,1); +SELECT ROW(1,2,3) = (SELECT 1,2,NULL); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a'); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b'); +SELECT (SELECT 1.5,2,'a') = ROW('b',2,'b'); +SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); +SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); +SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; create table t1 (a int); create table t2 (a int, b int); create table t3 (a int); @@ -44,11 +67,11 @@ select (select a from t3), a from t2; select * from t2 where t2.a=(select a from t1); insert into t3 values (6),(7),(3); select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1); -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 order by a limit 2) limit 3; -select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +(select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); -explain select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1) +explain (select * from t2 where t2.b=(select a from t3 order by 1 desc limit 1)) union (select * from t4 where t4.b=(select max(t2.a)*4 from t2) order by a); select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2; select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from @@ -115,8 +138,6 @@ SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1); SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2); SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3); -drop table if exists t8; - CREATE TABLE `t8` ( `pseudo` varchar(35) character set latin1 NOT NULL default '', `email` varchar(60) character set latin1 NOT NULL default '', @@ -275,7 +296,7 @@ select * from t1; drop table t1, t2; #multi-delete with subselects -drop table if exists t11, t12, t2; + create table t11 (a int NOT NULL, b int, primary key (a)); create table t12 (a int NOT NULL, b int, primary key (a)); create table t2 (a int NOT NULL, b int, primary key (a)); @@ -345,7 +366,7 @@ drop table t1, t2, t3; -- error 1096 SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *); -drop table if exists t; + CREATE TABLE t (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t VALUES (1),(2); SELECT * FROM t WHERE id IN (SELECT 1); @@ -363,7 +384,7 @@ CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin INSERT INTO t1 values (1),(1); -- error 1240 UPDATE t SET id=(SELECT * FROM t1); -drop table t; +drop table t, t1; #NULL test @@ -408,4 +429,51 @@ select 1.5 > ALL (SELECT * from t); select 10.5 > ALL (SELECT * from t); select 1.5 > ANY (SELECT * from t); select 10.5 > ANY (SELECT * from t); +explain select (select a+1) from t; +select (select a+1) from t; +drop table t; + +#LIMIT is not supported now +create table t (a float); +-- error 1235 +select 10.5 IN (SELECT * from t LIMIT 1); +-- error 1235 +select 10.5 IN (SELECT * from t LIMIT 1 UNION SELECT 1.5); drop table t; + +create table t1 (a int, b int, c varchar(10)); +create table t2 (a int); +insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c'); +insert into t2 values (1),(2),(NULL); +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2; +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2; +select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2; +drop table t1,t2; + +create table t1 (a int, b real, c varchar(10)); +insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b'); +select ROW(1, 1, 'a') IN (select a,b,c from t1); +select ROW(1, 2, 'a') IN (select a,b,c from t1); +select ROW(1, 1, 'a') IN (select b,a,c from t1); +select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null); +select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null); +select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null); +select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a'); +select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a'); +-- error 1235 +select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2); +drop table t1; + +create table t1 (a int); +insert into t1 values (1); +do @a:=(SELECT a from t1); +select @a; +set @a:=2; +set @a:=(SELECT a from t1); +select @a; +drop table t1; +-- error 1146 +do (SELECT a from t1); +-- error 1146 +set @a:=(SELECT a from t1); diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test index 586761921b8..67126930e60 100644 --- a/mysql-test/t/symlink.test +++ b/mysql-test/t/symlink.test @@ -3,10 +3,14 @@ disable_query_log; show variables like "have_symlink"; enable_query_log; +--disable_warnings +drop table if exists t1,t2,t7,t8,t9; +--enable_warnings + # # First create little data to play with # -drop table if exists t1,t2,t7,t8,t9; + create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)); create table t2 (a int not null auto_increment, b char(16) not null, primary key (a)); insert into t1 (b) values ("test"),("test1"),("test2"),("test3"); diff --git a/mysql-test/t/tablelock.test b/mysql-test/t/tablelock.test index fa8c4f03675..fbc5d685096 100644 --- a/mysql-test/t/tablelock.test +++ b/mysql-test/t/tablelock.test @@ -2,7 +2,10 @@ # Test of lock tables # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + create table t1 ( n int auto_increment primary key); lock tables t1 write; insert into t1 values(NULL); diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 665e690a322..03b6fa35bfa 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -2,7 +2,10 @@ # Test of temporary tables # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 (c int not null, d char (10) not null); insert into t1 values(1,""),(2,"a"),(3,"b"); CREATE TEMPORARY TABLE t1 (a int not null, b char (10) not null); @@ -34,7 +37,6 @@ drop table t1; # Test CONCAT_WS with temporary tables # -drop table if exists t1; CREATE TABLE t1 (pkCrash INTEGER PRIMARY KEY,strCrash VARCHAR(255)); INSERT INTO t1 ( pkCrash, strCrash ) VALUES ( 1, '1'); SELECT CONCAT_WS(pkCrash, strCrash) FROM t1; @@ -74,8 +76,6 @@ drop table t1; # In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based # temporary table when a memory based one would be good enough. -drop table if exists t1; - CREATE TABLE t1 ( d datetime default NULL ) TYPE=MyISAM; diff --git a/mysql-test/t/truncate.test b/mysql-test/t/truncate.test index eeb79f497fa..dd80baba269 100644 --- a/mysql-test/t/truncate.test +++ b/mysql-test/t/truncate.test @@ -1,7 +1,10 @@ # # Test of truncate # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a integer, b integer,c1 CHAR(10)); insert into t1 (a) values (1),(2); truncate table t1; diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 234daeabc2b..6a55c61f8a1 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -1,7 +1,10 @@ # # Basic cleanup # +--disable_warnings drop table if exists t1,t2,t3,t4,t5,t6,t7; +--enable_warnings + # # Check syntax for creating BLOB/TEXT @@ -23,7 +26,11 @@ drop table t1,t2,t3 CREATE TABLE t1 (a char(257) default "hello"); --error 1101 CREATE TABLE t2 (a blob default "hello"); + +# Safety to be able to continue with other tests if above fails +--disable_warnings drop table if exists t1,t2; +--enable_warnings # # test of full join with blob diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 68c2d55aac9..6319a3990e6 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -1,6 +1,10 @@ # # test of problem with date fields # +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a char(16), b date, c datetime); insert into t1 SET a='test 2000-01-01', b='2000-01-01', c='2000-01-01'; select * from t1 where c = '2000-01-01'; @@ -11,7 +15,6 @@ drop table t1; # problem with date conversions # -drop table if exists t1,t2; CREATE TABLE t1 (name char(6),cdate date); INSERT INTO t1 VALUES ('name1','1998-01-01'); INSERT INTO t1 VALUES ('name2','1998-01-01'); diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 991f11e86ea..f791cd76d34 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -2,7 +2,10 @@ # testing different DATETIME ranges # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t datetime); insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959); select * from t1; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 7f73ec34e3a..9b10e8943ad 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -1,6 +1,9 @@ # bug in decimal() with negative numbers by kaido@tradenet.ee +--disable_warnings DROP TABLE IF EXISTS t1; +--enable_warnings + CREATE TABLE t1 ( id int(11) DEFAULT '0' NOT NULL auto_increment, datatype_id int(11) DEFAULT '0' NOT NULL, diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 8f399e4364e..49ba73acaa8 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -2,7 +2,10 @@ # Problem with many enums # +--disable_warnings DROP TABLE if exists t1; +--enable_warnings + CREATE TABLE t1 ( field enum('001001','001004','001010','001018','001019','001020','001021','001027','001028','001029','001030','001031','001100','002003','002004','002005','002007','002008','002009','002012','002013','002014','003002','003003','003004','003005','003006','003007','003008','003009','003010','003011','003012','003013','003014','003015','003016','003017','003018','003019','004002','004003','004005','004006','004007','004008','004010','004012','004014','004016','004017','004020','004021','004022','004023','004024','004025','004026','006002','006004','006006','006010','006011','006012','006013','006014','007001','007002','007003','007004','007005','007006','007007','007008','007009','007010','007011','007012','007013','007014','007015','007016','007017','007018','007019','007020','007021','007022','007023','007024','007025','007026','007027','007028','007029','007030','007031','007032','007033','007034','007035','007036','007037','007038','007039','007040','007043','007044','009001','009002','009004','009005','009006','009007','009008','009009','009010','009011','009012','009013','010002','010003','010004','010005','010006','010007','010008','010009','010010','010011','010012','010013','010015','010016','010017','010018','010019','010020','010021','010022','010023','010024','010025','010026','010027','010028','011001','011002','011003','011004','011006','011012','011013','011014','011015','011016','012017','012018','012019','012023','012027','012028','012029','012030','012031','012032','012033','012034','012035','012036','012037','012038','012039','014001','016002','016003','016004','016007','016010','016011','016016','016019','016020','016021','016022','016023','016024','016026','016027','016028','016029','016030','016031','016032','016033','016034','017002','018001','019002','019004','020001','020003','020004','020005','020006','020007','020008','020009','022001','022002','022003','023001','023002','023003','023004','023005','023006','023007','023008','023010','023011','023012','023017','023019','023020','023021','023025','023026','023027','023028','023029','023030','023031','023032','023033','023034','023035','025001','025003','025004','025005','025006','025007','025008','025009','025010','025011','025012','025013','025014','025015','025016','025017','025018','025019','025020','025021','025022','025023','025024','025025','025026','025027','025028','025029','025030','025031','025032','025033','025034','025035','025036','025037','025038','025039','025040','025041','025042','025043','025044','025045','025046','025047','025048','025049','025050','025051','025052','025053','025054','025055','025056','025057','025058','025059','025060','025061','025062','025063','027001','027002','027011','035008','035012','036001','037001','037003','037004','037005','037006','037007','037008','037009','038004','038005','038006','038007','038009','039001','039002','039003','039004','039005','039006','046001','046002','046003','046004','046005','046007','046008','046009','046010','046011','046012','046013','046014','047001','047002','048001','051001','051002','051003','051004','052001','052002','052005','053015','053016','053019','053020','053023','053024','053026','053028','053029','053033','053034','053036','053037','053038','053039','053041','053042','053043','053045','053046','053047','053048','053051','053052','053054','053055','053056','053057','053068','053069','053070','053073','053074','053075','053086','053094','053095','053096','053097','053098','053099','053100','053101','053102','053103','053104','053105','053107','053122','053123','053124','053125','053127','053128','054001','054002','054003','054004','054005','054006','054007','054009','054010','056001','056002','056003','056004','056005','056006','056009','056010','056011','056016','056017','056018','056019','056020','056021','056022','057001','057002','057003','057004','058002','058003','058004','058005','060001','060003','060004','060005','060006','060007','061002','061003','061004','061005','061006','069006','069007','069010','069011','069012','069013','069014','069015','069016','069017','069018','069020','069021','069022','069023','069024','071002','071003','071004','071005','071006','071008','071011','071013','071020','071021','071022','072001','073001','073002','073003','073004','074001','074002','074003','074004','074005','074006','074007','074008','074009','074010','074011','074012','075001','075007','076101','076102','076103','077001','077002','077003','077004','077006','077007','077008','077009','078005','079002','079003','079004','079005','079006','079007','081001','082006','082007','082011','082013','082014','082015','082016','082017','082021','082022','082023','082024','082025','082026','082027','082028','082029','082030','082031','082032','082033','082034','082035','082036','082037','082038','082039','082040','082041','082042','082043','082044','084001','084002','084003','084004','084005','084007','084008','084009','084011','084013','084014','084016','084017','084027','084031','084032','084033','084035','084036','084037','084038','084039','084040','084041','084042','084043','084044','084045','084046','084047','084048','084049','084050','084051','085001','085002','085003','085004','085005','085006','085007','085009','085011','085012','085013','085014','085015','085016','085017','085018','085019','085020','085021','085022','085023','085028','085029','085030','085031','085033','085034','085035','085036','085037','085038','085040','085041','085042','085043','085044','085045','085046','085047','085048','085063','085064','085065','085068','085070','085071','085073','085082','085083','085086','085088','085089','085090','085091','085092','085093','085094','085095','085096','085097','085098','085099','085100','085101','085102','085103','085104','085105','085106','085107','085108','085109','085110','085111','085112','085113','085115','085119','085120','085121','085122','085123','085124','085125','085126','085127','085128','085129','085130','085132','085133','085134','085135','085136','085137','086001','086002','086003','086004','086005','088001','088003','088005','088006','088007','088008','088009','089001','090001','090002','090003','090004','090005','090006','090007','090008','090009','090010','090013','090015','090016','090017','090018','090019','090022','090027','090028','091001','091002','091005','091008','091009','091010','091011','091012','091013','091014','091015','091016','091017','091018','093001','093003','093098','093100','093102','093104','093141','093142','093146','093151','093153','093167','093168','093176','094001','094002','094004','094005','095004','099001','099002','100001','101001','102002','102003','105001','105002','106001','113001','113002','113003','113004','113005','113006','113007','113008','113009','113010','113011','113012','113013','113014','113015','113016','113017','113018','113019','113020','113021','113022','113023','113024','113025','113026','113027','113028','114001','115001','115002','115003','115004','115005','115006','115007','115008','115009','115010','115011','115012','115013','115014','115015','115016','115017','115018','115020','115021','115022','115023','115025','115026','115027','115028','115029','115030','115031','115032','115033','115034','115035','115036','115039','115040','115041','115042','115043','115044','115045','115046','115047','115048','115049','115050','115051','115052','115053','115054','115055','115056','115057','115059','115060','115061','115062','115063','115064','115065','115066','115067','115068','115069','115070','115071','115072','115073','115075','115076','115081','115082','115085','115086','115087','115088','115095','115096','115097','115098','115099','115101','115102','115103','115104','115105','115106','115108','115109','115110','115111','115112','115113','115114','115115','115116','115117','115118','115119','115120','115121','115122','116001','116002','116003','116004','116005','116006','116007','116008','116009','116010','116011','116012','117001','117002','117003','123001','124010','124014','124015','124019','124024','124025','124026','124027','124028','124029','124030','124031','124032','124033','124035','124036','124037','124038','124039','124040','124041','124042','124043','124044','124045','124046','124047','124048','124049','124050','124051','124052','124053','124054','124055','124056','124057','124058','124059','124060','124061','124062','124063','124064','124065','126001','126002','126003','126004','126005','126006','126007','126008','126009','126010','126011','126012','130001','132001','132002','132003','133001','133008','133009','133010','133011','133012','133013','133014','133015','133016','133017','133018','133019','133020','133021','133022','133023','133024','133025','133027','133028','133029','133030','133031','134001','135001','135002','135003','135004','135005','135006','135007','135008','135009','135010','136001','137009','137010','137011','137012','137013','137014','137015','137016','137017','137018','137019','138001','138002','138003','138004','139001','139003','140001','141001','141002','141003','141006','141007','141008','141009','141011','141012','141014','141015','141016','141017','141018','141019','141020','141021','141022','141023','141024','141025','141026','141027','141028','142001','142002','142003','142004','142005','142006','142007','142008','142010','142011','142012','144001','145001','145002','145003','145004','145005','145006','145007','145008','145009','145010','145011','145012','145013','145014','145015','145016','147001','150003','150005','150009','150013','150014','150015','150016','150017','150020','150021','152001','152002','152003','152004','152005','152006','152007','154001','154002','154003','155001','155002','155003','155004','155005','155006','159001','159002','159003','159004','160001','160002','160003','161001','162001','162002','162003','162004','162007','162010','162011','162012','163001','163002','163003','163005','163010','163011','163014','163015','163016','165001','165002','165003','165004','165005','165006','165007','165008','165009','165010','165011','165012','165013','165014','165015','165016','165017','165018','165019','165020','165021','165022','165023','165024','165025','165026','165027','165028','165029','165030','165031','165032','165033','165034','165035','165036','167001','168001','168002','168003','168004','168005','168007','168008','168009','168010','168011','168012','168013','168014','169001','169002','169003','169007','169008','169009','169010','170001','171001','171002','171003','171004','171005','171006','171007','171008','171009','172001','174001','174002','174003','176001','176002','176003','177001','177002','179001','179002','179003','179004','179005','179006','179007','179008','179009','179010','179011','179012','179013','179014','179015','179016','179017','179018','179019','179020','179021','179022','179023','179024','179025','179026','179027','179028','179029','179030','179031','179032','179033','179034','179035','179036','179037','179038','179039','179040','179041','179042','179043','179044','179045','179046','179047','180001','180010','180012','180013','180014','180015','180016','180017','180018','180019','180020','180021','180022','180023','180024','180025','180026','180027','180028','180030','180031','180032','180033','180034','180035','180036','180037','180038','180039','180041','180042','180043','180044','180045','180046','180047','180048','180049','180050','180051','180052','180053','180054','180055','180056','180057','180058','180059','180060','180061','180062','180063','180064','180065','180066','180067','180068','180069','180070','180071','182001','184001','184002','184005','184006','184007','184008','184009','184010','184011','185001','185003','187001','188001','188002','188003','188004','188005','188006','188007','188008','188009','188010','188011','191001','191002','192002','194001','194002','194003','194004','194005','194006','194007','195001','195002','195003','195004','195005','195006','195007','196001','196002','197001','197002','197003','197004','197005','197006','198001','198003','198004','198005','198006','198007','198008','198009','198010','198011','198012','198013','198014','198015','198016','198017','201001','201002','201005','202001','203001','203002','203003','203017','203018','203019','204001','204002','204003','205001','208001','208002','208003','208004','208005','209001','209002','209003','210001','210002','210003','210004','210005','210006','210007','210008','210009','210010','210011','210012','210013','211017','212001','212002','212003','212004','212005','212006','212007','212008','212009','212010','212011','212012','212013','218001','218003','218004','218006','218007','218008','218009','218011','218015','218016','218017','218018','218019','218020','218021','218022','218023','218024','218025','218026','218027','218028','218029','218030','218031','218032','218033','218034','218035','218036','221001','221002','221003','221004','221005','221006','221007','221008','221009','221010','221011','221012','221013','223001','223002','223003','224001','224002','224003','224006','224007','224008','225001','225002','225003','225004','225005','225006','225007','225008','225009','225010','225011','225012','225013','226001','226002','226003','226004','226005','226006','226007','226008','226009','227001','227002','227003','227004','227005','227006','227007','227008','227009','227010','227011','227012','227013','227014','227015','227016','227017','227018','227019','227020','227021','227022','227023','227024','227025','227026','227027','227028','227029','227030','227031','227032','227033','227034','227035','227036','227037','227038','227039','227040','227041','227042','227043','227044','227045','227046','227047','227048','227049','227050','227051','227052','227053','227054','227055','227056','227057','227058','227059','227060','227061','227062','227063','227064','227065','227066','227067','227068','227069','227070','227071','227072','227073','227074','227075','227076','227077','227078','227079','227080','227081','227082','227083','227084','227085','227086','227087','227088','227089','227090','227091','227092','227093','227094','227095','227096','227097','227098','227099','227100','227101','227102','227103','227104','227105','227106','227107','227108','227109','227110','227111','227112','227113','227114','227115','227116','227117','227118','227119','227120','227122','227123','227124','227125','227126','227127','227128','227129','227130','227131','227132','227133','227134','227135','227136','227137','227138','227139','227140','227141','227142','227143','227144','227145','227146','227147','227148','227149','227150','227151','227152','228001','229001','229002','229003','229004','229005','230001','230002','232001','233001','233002','233003','233004','233005','233006','233007','233008','234001','234002','234003','234004','234005','234006','234007','234008','234009','234010','234011','234012','234013','234014','234015','234016','234017','234018','234019','234020','234021','234022','234023','234024','234025','234026','234027','234028','234029','234030','235001','235002','235003','235004','235005','236001','236002','236003','237001','238002','238003','238004','238005','238006','238007','238008','333013','333014','333015','333016','333017','333018','333019','333020','333021','333022','333023','333024','333025','333030','333031','333032','333033','333034','333035','334001','334002','334003','334004','334005','334006','334007','336004','337001','337002','337003','337004','339001','339002','343001','344001','344002','344003','344004','344005','345001','345002','345003','347001','347002','348001','348002','348003','348004','348005','349001','349002','349003','350001','353001','353002','353003','353004','355001','355002','355003','355004','355005','355006','356001','358001','359001','359002','360001','360002','360003','360004','360005','366001','366002','366003','366004','369001','373001','373002','373003','373004','373005','373006','373007','373008','373009','373010','373011','373012','373013','373014','373015','373016','373017','373018','373019','373020','373021','374001','374002','374003','374004','374005','374006','374007','374008','374009','374010','374011','374012','374013','374014','374015','374016','376001','376002','376003','376004','376005','376006','376007','376008','376009','376010','376011','376012','376013','376016','376017','376018','376019','376020','376021','379003','382001','382002','383001','384001','384002','385001','385002','386001','386002','386003','386004','386005','386006','386007','386008','386009','386010','386011','386012','386013','386014','387001','389001','389002','389003','389004','392001','393001','393002','393003','393004','395001','396001','397001','397002','399001','399002','399003','400001','400002','401001','401002','401003','402001','402002','402003','402004','402005','403001','403002','403003','504001','504002','504004','504005','504006','504007','504008','504009','504010','504011','504012','504013','504014','504017','504018','504019','504021','504022','504023','504024','504025','506001','506002','508001','508002','511001','511002','511003','511004','511005','511006','511007','511008','511009','511010','511011','511012','511013','511014','511017','511018','511020','511021','511022','511024','511028','511029','513001','513002','513003','513004','514001','515001','515002','515003','515007','515008','515009','515010','515011','515012','515013','515014','515015','518001','518002','518003','520001','520002','521001','521002','521003','521004','521005','521006','521007','521008','521009','521010','521011','521012','521013','521014','521015','521016','523001','523002','523003','523004','523005','523006','523007','524001','700001','701001','701002','701003','702001','702002','702003','702004','702005','702006','702007','702008','703001','703002','703003','704001','704002','704003','704004','705001','706001','706002','707001','707002','707003','708001','709001','709002','710001','710002','711001','711002','712001','713001','713002','714001','714002','715001','716001','718001','718002','719001','719002','991001','991002','991003','991004','991005','991006','991007','991008','992001','995001','996001','996002','996003','998001','998002','998003','998004','998005','998006','998007','999001','999002','011017','011018','034001','034002','071010','208006','239001','519001','519003','126013','184012','053071','374017','374018','374019','374020','374021','404001','405002','405001','405003','405007','405006','405005','405004','240011','240010','240009','240008','240007','240006','240005','240004','240003','240002','240001','240012','240013','240014','240015','240016','240017','357001','235006','235007','712002','355008','355007','056023','999999','046015','019005','126014','241003','241002','241001','240018','240020','240019','242001','242002','242003','242004','242005','242006','089002','406001','406002','406003','406004','406005','406006','243001','243002','243003','243004','243005','243006','243007','243008','010030','010029','407001','407006','407005','407004','407003','407002','408001','366005','133032','016035','077010','996004','025064','011019','407007','407008','407009','409001','115123','504026','039007','039009','039008','039010','039011','039012','180072','240021','240023','408002','405008','235008','525001','525002','525003','525004','410001','410002','410003','410004','410005','410006','410007','410008','410009','410010','410011','410012','410013','410014','410015','410016','344006','240031','240030','240029','240028','240027','240026','240025','240024','240034','240033','240032','410017','410018','411001','411002','411003','411004','411005','411006','411007','411008','203020','203021','203022','412001','412002','412003','412004','069025','244001','244002','244009','244008','244007','244006','244005','244004','244003','244015','244014','244013','244012','244011','244010','244016','244017','240042','240041','240040','240039','240038','240037','240036','240035','405009','405010','240043','504034','504033','504032','504031','504030','504029','504028','504027','504042','504041','504040','504039','504038','504037','504036','504035','800001','410019','410020','410021','244018','244019','244020','399004','413001','504043','198018','198019','344007','082045','010031','010032','010033','010034','010035','504044','515016','801002','801003','801004','801005','802001','801001','414001','414002','414003','141029','141030','803001','803002','803003','803004','803005','803006','803007','803008','803009','803010','803011','803012','803013','803014','803015','803016','803017','410022','410023','803018','803019','803020','415002','415001','244021','011020','011023','011022','011021','025065','165037','165038','165039','416001','416002','416003','417001','418001','504045','803022','803021','240022','419001','420001','804010','804009','804008','804007','804006','804005','804004','804003','804002','804001','804020','804019','804018','804017','804016','804015','804014','804013','804012','804011','804024','804021','804023','804022','511019','511016','511015','511032','511031','511030','511027','511026','511025','511033','511023','133034','133033','169011','344008','344009','244022','244026','244025','244030','244023','244024','244027','244028','244029','244031','082046','082047','082048','126015','126016','416004','416005','421001','421002','016037','016036','115124','115125','115126','240049','240048','240047','240046','240045','240044','244032','244033','422001','422002','422003','422004','422005','184013','239002','805001','805002','805003','805004','805005','056024','423001','344010','235009','212014','056025','056026','802002','244034','244035','244036','244037','244038','244039','515017','504046','203015','245002','245001','071023','056027','056028','056029','056030','056031','056032','424001','056034','056033','805006','805007','805008','805009','805010','422008','422007','422006','422010','422009','422011','209004','150022','150023','100002','056035','023036','185004','185005','246001','247001','247002','425001','416006','165042','165041','165040','165043','010040','010039','010038','010037','010036','422012','422013','422014','422015','426000','248001','248002','248003','248004','248005','249001','249002','249003','249004','249005','249006','250007','250001','250002','250003','250004','250005','250006','250008','250009','250010','250011','250012','250013','251001','251002','422016','422017','422018','806001','806002','116013','235010','235011','091026','091027','091028','091029','091019','091020','091021','091022','091023','091024','091025','252001','243009','249007','249008','249009','011024','011025','427001','428002','428001','169012','429001','429002','429003') DEFAULT '001001' NOT NULL, KEY field (field) diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 23941ad2913..f6281ca6c21 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -2,11 +2,14 @@ # ----------- # Numeric floating point. +--disable_warnings +drop table if exists t1; +--enable_warnings + SELECT 10,10.0,10.,.1e+2,100.0e-1; SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000; SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; -drop table if exists t1; create table t1 (f1 float(24),f2 float(52)); show full columns from t1; insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); @@ -44,6 +47,8 @@ drop table t1; # Errors -!$1063 create table t1 (f float(54)); # Should give an error +--error 1063 +create table t1 (f float(54)); # Should give an error +--disable_warnings drop table if exists t1; - +--enable_warnings diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test index a07a1d97f37..53bfb063b2c 100644 --- a/mysql-test/t/type_ranges.test +++ b/mysql-test/t/type_ranges.test @@ -2,7 +2,9 @@ # Test ranges for all types and some other basic tests # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings CREATE TABLE t1 ( auto int(5) unsigned DEFAULT 0 NOT NULL auto_increment, diff --git a/mysql-test/t/type_set.test b/mysql-test/t/type_set.test index 7f1a75e5dbd..4505e3f747b 100644 --- a/mysql-test/t/type_set.test +++ b/mysql-test/t/type_set.test @@ -2,7 +2,10 @@ # Test of SET with space # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (a set (' ','a','b') not null); show create table t1; drop table t1; diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test index 2496ec36915..2f342f8bf67 100644 --- a/mysql-test/t/type_time.test +++ b/mysql-test/t/type_time.test @@ -1,7 +1,11 @@ # # testing of the TIME column type # + +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (t time); insert into t1 values("10:22:33"),("12:34:56.78"),(10),(1234),(123456.78),(1234559.99),("1"),("1:23"),("1:23:45"), ("10.22"), ("-10 1:22:33.45"),("20 10:22:33"),("1999-02-03 20:33:34"); insert t1 values (30),(1230),("1230"),("12:30"),("12:30:35"),("1 12:30:31.32"); diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index c51d439fde4..1c9275ecd0a 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -2,7 +2,10 @@ # Test timestamp # +--disable_warnings drop table if exists t1,t2; +--enable_warnings + CREATE TABLE t1 (a int, t timestamp); CREATE TABLE t2 (a int, t datetime); SET TIMESTAMP=1234; diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index 32bcd61ecdb..b4c88eae95d 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -2,7 +2,10 @@ # test of unsigned int # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (this int unsigned); insert into t1 values (1); insert into t1 values (-1); diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index 8f4f23badb4..9922df447fc 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -1,7 +1,10 @@ # # Test year # +--disable_warnings drop table if exists t1; +--enable_warnings + create table t1 (y year,y2 year(2)); insert into t1 values (0,0),(1999,1999),(2000,2000),(2001,2001),(70,70),(69,69); select * from t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 449bafbdef6..b46f54c5c41 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -2,7 +2,10 @@ # Test of unions # +--disable_warnings drop table if exists t1,t2,t3; +--enable_warnings + CREATE TABLE t1 (a int not null, b char (10) not null); insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c'); CREATE TABLE t2 (a int not null, b char (10) not null); @@ -88,7 +91,7 @@ SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pse SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION ALL SELECT pseudo FROM t1 WHERE pseudo1='joce'; SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT 1; drop table t1; -drop table if exists t1,t2; + create table t1 (a int); create table t2 (a int); insert into t1 values (1),(2),(3),(4),(5); diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test index 5cbbd2a350e..31d22c1f850 100644 --- a/mysql-test/t/update.test +++ b/mysql-test/t/update.test @@ -2,7 +2,10 @@ # test of updating of keys # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + create table t1 (a int auto_increment , primary key (a)); insert into t1 values (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); update t1 set a=a+10 where a > 34; @@ -85,5 +88,8 @@ create table t1 (a int not null, b int not null); insert into t1 values (1,1),(1,2),(1,3); update t1 set b=4 where a=1 order by b asc limit 1; update t1 set b=4 where a=1 order by b desc limit 1; +create table t2 (a int not null, b int not null); +insert into t2 values (1,1),(1,2),(1,3); select * from t1; -drop table t1; +update t1 set b=(select distinct 1 from (select * from t2) a); +drop table t1,t2; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index bb1a9b59611..6260db8c370 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -1,11 +1,15 @@ -error 1054; +# Initialise +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + +--error 1054 set @a := foo; set @a := connection_id() + 3; select @a - connection_id(); # Check using and setting variables with SELECT DISTINCT -drop table if exists t1,t2; CREATE TABLE t1 ( i int not null, v int not null,index (i)); insert into t1 values (1,1),(1,3),(2,1); create table t2 (i int not null, unique (i)); diff --git a/mysql-test/t/varbinary.test b/mysql-test/t/varbinary.test index cc9ee99b7f9..d58954a189b 100644 --- a/mysql-test/t/varbinary.test +++ b/mysql-test/t/varbinary.test @@ -1,3 +1,8 @@ +# Initialise +--disable_warnings +drop table if exists t1; +--enable_warnings + # # varbinary as string and number # @@ -10,7 +15,6 @@ select x'31',X'ffff'+0; # Test of hex constants in WHERE: # -drop table if exists t1; create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint(21) unsigned zerofill not null,primary key (ID),unique (UNIQ) ); insert into t1 set UNIQ=0x38afba1d73e6a18a; insert into t1 set UNIQ=123; diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 552777743f8..39aa5a20a71 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1,7 +1,10 @@ # # test variables # -drop table if exists t1; +--disable_warnings +drop table if exists t1,t2; +--enable_warnings + set @`test`=1,@TEST=3,@select=2,@t5=1.23456; select @test,@`select`,@TEST,@not_used; set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL; @@ -34,13 +37,15 @@ drop table t1; set max_join_size=100; show variables like 'max_join_size'; -# Removed, because it has different value with/without BIG_TABLES -#show global variables like 'max_join_size'; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR +show global variables like 'max_join_size'; set GLOBAL max_join_size=2000; show global variables like 'max_join_size'; set max_join_size=DEFAULT; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show variables like 'max_join_size'; set GLOBAL max_join_size=DEFAULT; +--replace_result 18446744073709551615 HA_POS_ERROR 4294967295 HA_POS_ERROR show global variables like 'max_join_size'; set @@max_join_size=1000, @@global.max_join_size=2000; select @@local.max_join_size, @@global.max_join_size; @@ -227,7 +232,6 @@ set log_warnings=1; # key buffer # -DROP TABLE IF EXISTS t1,t2; create table t1 (a int not null auto_increment, primary key(a)); create table t2 (a int not null auto_increment, primary key(a)); insert into t1 values(null),(null),(null); diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 5fb536def71..8cff8706c43 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -1,7 +1,10 @@ # # Test some warnings # +--disable-warnings drop table if exists t1; +--enable-warnings + create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); @@ -11,3 +14,15 @@ insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); drop table t1; set SQL_WARNINGS=0; + +# +# Test other warnings + +drop temporary table if exists not_exists; +drop table if exists not_exists_table; +show warnings limit 1; +drop database if exists not_exists_db; +show count(*) warnings; +create table t1(id int); +create table if not exists t1(id int); +select @@warning_count; |