summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/README7
-rwxr-xr-xmysql-test/create-test-result5
-rw-r--r--mysql-test/include/master-slave.inc4
-rw-r--r--mysql-test/mysql-test-run.sh32
-rw-r--r--mysql-test/r/alter_table.result10
-rw-r--r--mysql-test/r/bdb.result16
-rw-r--r--mysql-test/r/compare.result4
-rw-r--r--mysql-test/r/create.result34
-rw-r--r--mysql-test/r/ctype_many.result1393
-rw-r--r--mysql-test/r/derived.result67
-rw-r--r--mysql-test/r/distinct.result30
-rw-r--r--mysql-test/r/explain.result20
-rw-r--r--mysql-test/r/fulltext.result4
-rw-r--r--mysql-test/r/func_system.result3
-rw-r--r--mysql-test/r/func_test.result3
-rw-r--r--mysql-test/r/group_by.result20
-rw-r--r--mysql-test/r/heap.result32
-rw-r--r--mysql-test/r/heap_auto_increment.result41
-rw-r--r--mysql-test/r/heap_btree.result235
-rw-r--r--mysql-test/r/heap_hash.result205
-rw-r--r--mysql-test/r/innodb.result56
-rw-r--r--mysql-test/r/isam.result8
-rw-r--r--mysql-test/r/join_outer.result46
-rw-r--r--mysql-test/r/key_diff.result6
-rw-r--r--mysql-test/r/key_primary.result8
-rw-r--r--mysql-test/r/merge.result32
-rw-r--r--mysql-test/r/myisam.result34
-rw-r--r--mysql-test/r/null_key.result104
-rw-r--r--mysql-test/r/odbc.result4
-rw-r--r--mysql-test/r/order_by.result98
-rw-r--r--mysql-test/r/range.result6
-rw-r--r--mysql-test/r/rollback.result19
-rw-r--r--mysql-test/r/rpl000001.result14
-rw-r--r--mysql-test/r/rpl000002.result8
-rw-r--r--mysql-test/r/rpl000003.result4
-rw-r--r--mysql-test/r/rpl000004.result4
-rw-r--r--mysql-test/r/rpl000005.result4
-rw-r--r--mysql-test/r/rpl000006.result4
-rw-r--r--mysql-test/r/rpl000008.result4
-rw-r--r--mysql-test/r/rpl000009.result4
-rw-r--r--mysql-test/r/rpl000010.result4
-rw-r--r--mysql-test/r/rpl000011.result8
-rw-r--r--mysql-test/r/rpl000012.result4
-rw-r--r--mysql-test/r/rpl000013.result4
-rw-r--r--mysql-test/r/rpl000015.result10
-rw-r--r--mysql-test/r/rpl000017.result2
-rw-r--r--mysql-test/r/rpl000018.result8
-rw-r--r--mysql-test/r/rpl_alter.result4
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result4
-rw-r--r--mysql-test/r/rpl_failsafe.result8
-rw-r--r--mysql-test/r/rpl_flush_log_loop.result12
-rw-r--r--mysql-test/r/rpl_get_lock.result4
-rw-r--r--mysql-test/r/rpl_log.result112
-rw-r--r--mysql-test/r/rpl_log_pos.result24
-rw-r--r--mysql-test/r/rpl_mystery22.result10
-rw-r--r--mysql-test/r/rpl_redirect.result4
-rw-r--r--mysql-test/r/rpl_replicate_do.result4
-rw-r--r--mysql-test/r/rpl_rotate_logs.result40
-rw-r--r--mysql-test/r/rpl_skip_error.result4
-rw-r--r--mysql-test/r/rpl_sporadic_master.result8
-rw-r--r--mysql-test/r/select.result132
-rw-r--r--mysql-test/r/select_found.result20
-rw-r--r--mysql-test/r/show_check.result45
-rw-r--r--mysql-test/r/subselect.result291
-rw-r--r--mysql-test/r/symlink.result8
-rw-r--r--mysql-test/r/type_blob.result52
-rw-r--r--mysql-test/r/type_datetime.result4
-rw-r--r--mysql-test/r/type_enum.result8
-rw-r--r--mysql-test/r/type_float.result32
-rw-r--r--mysql-test/r/type_ranges.result170
-rw-r--r--mysql-test/r/type_set.result8
-rw-r--r--mysql-test/r/union.result41
-rw-r--r--mysql-test/r/user_var.result16
-rw-r--r--mysql-test/r/varbinary.result4
-rw-r--r--mysql-test/r/variables.result5
-rw-r--r--mysql-test/std_data/master-bin.000001 (renamed from mysql-test/std_data/master-bin.001)bin98 -> 98 bytes
-rw-r--r--mysql-test/t/README0
-rw-r--r--mysql-test/t/bdb-deadlock.test11
-rw-r--r--mysql-test/t/create.test23
-rw-r--r--mysql-test/t/ctype_many.test191
-rw-r--r--mysql-test/t/derived.test36
-rw-r--r--mysql-test/t/func_system.test1
-rw-r--r--mysql-test/t/func_test.test1
-rw-r--r--mysql-test/t/heap.test2
-rw-r--r--mysql-test/t/heap_auto_increment.test30
-rw-r--r--mysql-test/t/heap_btree.test155
-rw-r--r--mysql-test/t/heap_hash.test140
-rw-r--r--mysql-test/t/myisam.test2
-rw-r--r--mysql-test/t/rollback.test9
-rw-r--r--mysql-test/t/rpl000001.test10
-rw-r--r--mysql-test/t/rpl000002.test16
-rw-r--r--mysql-test/t/rpl000011.test16
-rw-r--r--mysql-test/t/rpl000015.test10
-rwxr-xr-xmysql-test/t/rpl000017-slave.sh2
-rw-r--r--mysql-test/t/rpl000017.test10
-rw-r--r--mysql-test/t/rpl000018.test12
-rw-r--r--mysql-test/t/rpl_failsafe.test8
-rw-r--r--mysql-test/t/rpl_flush_log_loop.test6
-rw-r--r--mysql-test/t/rpl_log.test30
-rw-r--r--mysql-test/t/rpl_log_pos.test17
-rw-r--r--mysql-test/t/rpl_mystery22.test14
-rw-r--r--mysql-test/t/rpl_rotate_logs.test40
-rw-r--r--mysql-test/t/rpl_sporadic_master.test16
-rw-r--r--mysql-test/t/select.test4
-rw-r--r--mysql-test/t/select_found.test8
-rw-r--r--mysql-test/t/show_check.test5
-rw-r--r--mysql-test/t/subselect.test184
-rw-r--r--mysql-test/t/type_blob.test28
-rw-r--r--mysql-test/t/union.test5
-rw-r--r--mysql-test/t/variables.test3
111 files changed, 3959 insertions, 834 deletions
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 57b22f0edbc..84d4a5bba9a 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -30,7 +30,7 @@ dist-hook:
$(INSTALL_DATA) $(srcdir)/t/*.test $(srcdir)/t/*.opt $(srcdir)/t/*.sh $(distdir)/t
$(INSTALL_DATA) $(srcdir)/include/*.inc $(distdir)/include
$(INSTALL_DATA) $(srcdir)/r/*.result $(srcdir)/r/*.require $(distdir)/r
- $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.001 $(distdir)/std_data
+ $(INSTALL_DATA) $(srcdir)/std_data/*.dat $(srcdir)/std_data/*.000001 $(distdir)/std_data
install-data-local:
$(mkinstalldirs) \
diff --git a/mysql-test/README b/mysql-test/README
index c5dc3e219de..7c6efe7940e 100644
--- a/mysql-test/README
+++ b/mysql-test/README
@@ -1,6 +1,10 @@
This directory contains a test suite for mysql daemon. To run
the currently existing test cases, simply execute ./mysql-test-run in
this directory. It will fire up the newly built mysqld and test it.
+
+If you want to run the test with a running MySQL server use the --external
+option to mysql-test-run.
+
Note that you do not have to have to do make install, and you could
actually have a co-existing MySQL installation - the tests will not
conflict with it.
@@ -13,8 +17,7 @@ http://www.mysql.com/doc/M/y/MySQL_test_suite.html
You can create your own test cases. To create a test case:
- cd t
- vi test_case_name.test
+ xeamacs t/test_case_name.test
in the file, put a set of SQL commands that will create some tables,
load test data, run some queries to manipulate it.
diff --git a/mysql-test/create-test-result b/mysql-test/create-test-result
index bfd64f32fc5..b9be2300976 100755
--- a/mysql-test/create-test-result
+++ b/mysql-test/create-test-result
@@ -27,14 +27,13 @@ test_name=$1
[ -z $test_name ] && usage
result_file=$RESULT_DIR/$test_name.result
+reject_file=$RESULT_DIR/$test_name.reject
[ -f $result_file ] && die "result file $result_file has already been created"
touch $result_file
echo "Running the test case against empty file, will fail, but don't worry"
-./mysql-test-run --do-test=$test_name
-
-reject_file=$result_file.reject
+./mysql-test-run --local $test_name
if [ -f $reject_file ] ; then
echo "Below are the contents of the reject file:"
diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc
index 474b1357e9e..1013cd2cd52 100644
--- a/mysql-test/include/master-slave.inc
+++ b/mysql-test/include/master-slave.inc
@@ -4,7 +4,7 @@ connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,);
connection slave;
--error 0,1199
-!slave stop;
+!stop slave;
@r/slave-stopped.result show status like 'Slave_running';
connection master;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
@@ -13,7 +13,7 @@ connection slave;
reset slave;
# Clean up old test tables
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
@r/slave-running.result show status like 'Slave_running';
# Set the default connection to 'master'
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 4317ba0e749..d585243c6bc 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -177,7 +177,7 @@ USER_TEST=
EXTRA_MASTER_OPT=""
EXTRA_MYSQL_TEST_OPT=""
-USE_RUNNING_SERVER=1
+USE_RUNNING_SERVER=""
DO_GCOV=""
DO_GDB=""
MANUAL_GDB=""
@@ -193,6 +193,7 @@ CHARACTER_SET=latin1
DBUSER=""
START_WAIT_TIMEOUT=10
STOP_WAIT_TIMEOUT=10
+TEST_REPLICATION=0
while test $# -gt 0; do
case "$1" in
@@ -205,6 +206,7 @@ while test $# -gt 0; do
--slave-binary=*)
SLAVE_MYSQLD=`$ECHO "$1" | $SED -e "s;--slave-binary=;;"` ;;
--local) USE_RUNNING_SERVER="" ;;
+ --extern) USE_RUNNING_SERVER="1" ;;
--tmpdir=*) MYSQL_TMP_DIR=`$ECHO "$1" | $SED -e "s;--tmpdir=;;"` ;;
--local-master)
MASTER_MYPORT=3306;
@@ -265,6 +267,9 @@ while test $# -gt 0; do
--user-test=*)
USER_TEST=`$ECHO "$1" | $SED -e "s;--user-test=;;"`
;;
+ --rpl)
+ TEST_REPLICATION=1
+ ;;
--mysqld=*)
TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"`
EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP"
@@ -1303,15 +1308,22 @@ $ECHO $DASH72
if [ -z "$1" ] ;
then
- if [ x$RECORD = x1 ]; then
- $ECHO "Will not run in record mode without a specific test case."
- else
- for tf in $TESTDIR/*.$TESTSUFFIX
- do
- run_testcase $tf
- done
- $RM -f $TIMEFILE # Remove for full test
- fi
+ if [ x$RECORD = x1 ]; then
+ $ECHO "Will not run in record mode without a specific test case."
+ else
+ if [ x$TEST_REPLICATION = x1 ]; then
+ for tf in $TESTDIR/rpl*.$TESTSUFFIX
+ do
+ run_testcase $tf
+ done
+ else
+ for tf in $TESTDIR/*.$TESTSUFFIX
+ do
+ run_testcase $tf
+ done
+ fi
+ $RM -f $TIMEFILE # Remove for full test
+ fi
else
while [ ! -z "$1" ]; do
tname=`$BASENAME $1 .test`
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 1d6d69465da..159421e8f88 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
-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) MUL select,insert,update,references
+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
DROP TABLE t1;
create table t1 (n int);
insert into t1 values(9),(3),(12),(10);
@@ -120,5 +120,5 @@ 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) YES NULL
+c char(10) character set latin1 YES NULL
drop table t1;
diff --git a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
index eb97d19136d..ef4dfc307bf 100644
--- a/mysql-test/r/bdb.result
+++ b/mysql-test/r/bdb.result
@@ -139,14 +139,14 @@ id parent_id level
1010 102 2
1015 102 2
explain select level from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
explain select level,id from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where
select level,id from t1 where level=1;
level id
1 1002
@@ -624,8 +624,8 @@ id parent_id level
1025 102 2
1016 102 2
explain select level from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 1 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index afd2a1a086b..3ad3465fac0 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -2,8 +2,8 @@ drop table if exists t1;
CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
select * from t1 where id=000000000001;
id
000000000001
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index c3083dbfb03..0be0d624fca 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -22,14 +22,13 @@ drop table if exists t1,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;
-The used table type doesn't support AUTO_INCREMENT columns
create table t1 (a int not null,b text) type=heap;
The used table type doesn't support BLOB/TEXT columns
create table t1 (a int ,primary key(a)) type=heap;
All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead
drop table if exists t1;
create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
-The used table type doesn't support AUTO_INCREMENT columns
+Incorrect table definition; There can only be one auto column and it must be defined as a key
create table t1 (ordid int(8), primary key (ordid));
All parts of a PRIMARY KEY must be NOT NULL; If you need NULL in a key, use UNIQUE instead
create table not_existing_database.test (a int);
@@ -62,8 +61,8 @@ create table t1 (a int auto_increment not null primary key, B CHAR(20));
insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
-table type possible_keys key key_len ref rows Extra
-t2 ref B B 21 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref B B 21 const 1 Using where
select * from t2 where b="world";
a B
3 world
@@ -72,10 +71,10 @@ 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) YES NULL
+x varchar(50) character set latin1 YES NULL
describe t2;
Field Type Null Key Default Extra
-x char(50) YES NULL
+x char(50) character set 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;
@@ -94,6 +93,24 @@ d date 0000-00-00
t time 00:00:00
dt datetime 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
+describe t2;
+Field Type Null Key Default Extra
+a int(11) 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;
+create table t2 (a int) select a as b, a+1 as b from t1;
+Duplicate column name 'b'
+drop table if exists 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;
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
@@ -132,7 +149,7 @@ t1 CREATE TABLE `t1` (
KEY `b_29` (`b`),
KEY `b_30` (`b`),
KEY `b_31` (`b`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
drop table t1;
create table t1 select if(1,'1','0'), month("2002-08-02");
drop table t1;
@@ -141,3 +158,6 @@ select * from t1;
if('2002'='2002','Y','N')
Y
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;
diff --git a/mysql-test/r/ctype_many.result b/mysql-test/r/ctype_many.result
new file mode 100644
index 00000000000..ddc3989282b
--- /dev/null
+++ b/mysql-test/r/ctype_many.result
@@ -0,0 +1,1393 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+comment CHAR(32) CHARACTER SET latin1 NOT NULL,
+koi8_ru_f CHAR(32) CHARACTER SET koi8_ru 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 ''
+) 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 ''
+) 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 ''
+) 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 '',
+ `latin5_f` char(32) character set latin5 NOT NULL default '',
+ `latin2_f` char(32) character set latin2 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 ''
+) 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');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('d','LAT SMALL D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('e','LAT SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('f','LAT SMALL F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('g','LAT SMALL G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('h','LAT SMALL H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('i','LAT SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('j','LAT SMALL J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('k','LAT SMALL K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('l','LAT SMALL L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('m','LAT SMALL M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('n','LAT SMALL N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('o','LAT SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('p','LAT SMALL P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('q','LAT SMALL Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('r','LAT SMALL R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('s','LAT SMALL S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('t','LAT SMALL T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('u','LAT SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('v','LAT SMALL V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('w','LAT SMALL W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('x','LAT SMALL X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('y','LAT SMALL Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('z','LAT SMALL Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('A','LAT CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('B','LAT CAPIT B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('C','LAT CAPIT C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('D','LAT CAPIT D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('E','LAT CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('F','LAT CAPIT F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('G','LAT CAPIT G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('H','LAT CAPIT H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('I','LAT CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('J','LAT CAPIT J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('K','LAT CAPIT K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('L','LAT CAPIT L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('M','LAT CAPIT M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('N','LAT CAPIT N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('O','LAT CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('P','LAT CAPIT P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Q','LAT CAPIT Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('R','LAT CAPIT R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('S','LAT CAPIT S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('T','LAT CAPIT T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('U','LAT CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('V','LAT CAPIT V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('W','LAT CAPIT W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('X','LAT CAPIT X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Y','LAT CAPIT Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Z','LAT CAPIT Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Á','CYR SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Â','CYR SMALL BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('×','CYR SMALL VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ç','CYR SMALL GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ä','CYR SMALL DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Å','CYR SMALL IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('£','CYR SMALL IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ö','CYR SMALL ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ú','CYR SMALL ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('É','CYR SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ë','CYR SMALL KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ì','CYR SMALL EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Í','CYR SMALL EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Î','CYR SMALL EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ï','CYR SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ð','CYR SMALL PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ò','CYR SMALL ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ó','CYR SMALL ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ô','CYR SMALL TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Õ','CYR SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Æ','CYR SMALL EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('È','CYR SMALL HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ã','CYR SMALL TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Þ','CYR SMALL CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Û','CYR SMALL SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ý','CYR SMALL SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ß','CYR SMALL HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ù','CYR SMALL YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ø','CYR SMALL SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ü','CYR SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('À','CYR SMALL YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ñ','CYR SMALL YA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('á','CYR CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('â','CYR CAPIT BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('÷','CYR CAPIT VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ç','CYR CAPIT GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ä','CYR CAPIT DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('å','CYR CAPIT IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('³','CYR CAPIT IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ö','CYR CAPIT ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ú','CYR CAPIT ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('é','CYR CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ë','CYR CAPIT KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ì','CYR CAPIT EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('í','CYR CAPIT EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('î','CYR CAPIT EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ï','CYR CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ð','CYR CAPIT PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ò','CYR CAPIT ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ó','CYR CAPIT ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ô','CYR CAPIT TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('õ','CYR CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('æ','CYR CAPIT EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('è','CYR CAPIT HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ã','CYR CAPIT TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('þ','CYR CAPIT CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('û','CYR CAPIT SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ý','CYR CAPIT SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ÿ','CYR CAPIT HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ù','CYR CAPIT YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ø','CYR CAPIT SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ü','CYR CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('à','CYR CAPIT YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ñ','CYR CAPIT YA');
+SELECT CONVERT(koi8_ru_f USING utf8),MIN(comment),COUNT(*) FROM t1 GROUP BY 1;
+CONVERT(koi8_ru_f USING utf8) MIN(comment) COUNT(*)
+a LAT CAPIT A 2
+b LAT CAPIT B 2
+c LAT CAPIT C 2
+d LAT CAPIT D 2
+e LAT CAPIT E 2
+f LAT CAPIT F 2
+g LAT CAPIT G 2
+h LAT CAPIT H 2
+i LAT CAPIT I 2
+j LAT CAPIT J 2
+k LAT CAPIT K 2
+l LAT CAPIT L 2
+m LAT CAPIT M 2
+n LAT CAPIT N 2
+o LAT CAPIT O 2
+p LAT CAPIT P 2
+q LAT CAPIT Q 2
+r LAT CAPIT R 2
+s LAT CAPIT S 2
+t LAT CAPIT T 2
+u LAT CAPIT U 2
+v LAT CAPIT V 2
+w LAT CAPIT W 2
+x LAT CAPIT X 2
+y LAT CAPIT Y 2
+z LAT CAPIT Z 2
+а CYR CAPIT A 2
+б CYR CAPIT BE 2
+в CYR CAPIT VE 2
+г CYR CAPIT GE 2
+д CYR CAPIT DE 2
+е CYR CAPIT IE 4
+ж CYR CAPIT ZHE 2
+з CYR CAPIT ZE 2
+и CYR CAPIT I 2
+к CYR CAPIT KA 2
+л CYR CAPIT EL 2
+м CYR CAPIT EM 2
+н CYR CAPIT EN 2
+о CYR CAPIT O 2
+п CYR CAPIT PE 2
+Ñ€ CYR CAPIT ER 2
+Ñ CYR CAPIT ES 2
+Ñ‚ CYR CAPIT TE 2
+у CYR CAPIT U 2
+Ñ„ CYR CAPIT EF 2
+Ñ… CYR CAPIT HA 2
+ц CYR CAPIT TSE 2
+ч CYR CAPIT CHE 2
+ш CYR CAPIT SHA 2
+щ CYR CAPIT SCHA 2
+ÑŠ CYR CAPIT HARD SIGN 2
+Ñ‹ CYR CAPIT YERU 2
+ь CYR CAPIT SOFT SIGN 2
+Ñ CYR CAPIT E 2
+ÑŽ CYR CAPIT YU 2
+Ñ CYR CAPIT YA 2
+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;
+comment koi8_ru_f utf8_f
+LAT SMALL A a a
+LAT SMALL B b b
+LAT SMALL C c c
+LAT SMALL D d d
+LAT SMALL E e e
+LAT SMALL F f f
+LAT SMALL G g g
+LAT SMALL H h h
+LAT SMALL I i i
+LAT SMALL J j j
+LAT SMALL K k k
+LAT SMALL L l l
+LAT SMALL M m m
+LAT SMALL N n n
+LAT SMALL O o o
+LAT SMALL P p p
+LAT SMALL Q q q
+LAT SMALL R r r
+LAT SMALL S s s
+LAT SMALL T t t
+LAT SMALL U u u
+LAT SMALL V v v
+LAT SMALL W w w
+LAT SMALL X x x
+LAT SMALL Y y y
+LAT SMALL Z z z
+LAT CAPIT A A A
+LAT CAPIT B B B
+LAT CAPIT C C C
+LAT CAPIT D D D
+LAT CAPIT E E E
+LAT CAPIT F F F
+LAT CAPIT G G G
+LAT CAPIT H H H
+LAT CAPIT I I I
+LAT CAPIT J J J
+LAT CAPIT K K K
+LAT CAPIT L L L
+LAT CAPIT M M M
+LAT CAPIT N N N
+LAT CAPIT O O O
+LAT CAPIT P P P
+LAT CAPIT Q Q Q
+LAT CAPIT R R R
+LAT CAPIT S S S
+LAT CAPIT T T T
+LAT CAPIT U U U
+LAT CAPIT V V V
+LAT CAPIT W W W
+LAT CAPIT X X X
+LAT CAPIT Y Y Y
+LAT CAPIT Z Z Z
+CYR SMALL A Á а
+CYR SMALL BE  б
+CYR SMALL VE × Ð²
+CYR SMALL GE Ç Ð³
+CYR SMALL DE Ä Ð´
+CYR SMALL IE Šе
+CYR SMALL IO £ Ñ‘
+CYR SMALL ZHE Ö Ð¶
+CYR SMALL ZE Ú Ð·
+CYR SMALL I É Ð¸
+CYR SMALL KA Ë Ðº
+CYR SMALL EL Ì Ð»
+CYR SMALL EM Í Ð¼
+CYR SMALL EN Πн
+CYR SMALL O Ï Ð¾
+CYR SMALL PE Рп
+CYR SMALL ER Ò Ñ€
+CYR SMALL ES Ó Ñ
+CYR SMALL TE Ô Ñ‚
+CYR SMALL U Õ Ñƒ
+CYR SMALL EF Æ Ñ„
+CYR SMALL HA È Ñ…
+CYR SMALL TSE à ц
+CYR SMALL CHE Þ Ñ‡
+CYR SMALL SHA Û Ñˆ
+CYR SMALL SCHA Ý Ñ‰
+CYR SMALL HARD SIGN ß ÑŠ
+CYR SMALL YERU Ù Ñ‹
+CYR SMALL SOFT SIGN Ø ÑŒ
+CYR SMALL E Ü Ñ
+CYR SMALL YU À ÑŽ
+CYR SMALL YA Ñ Ñ
+CYR CAPIT A á Ð
+CYR CAPIT BE â Б
+CYR CAPIT VE ÷ Ð’
+CYR CAPIT GE ç Г
+CYR CAPIT DE ä Д
+CYR CAPIT IE å Е
+CYR CAPIT IO ³ Ð
+CYR CAPIT ZHE ö Ж
+CYR CAPIT ZE ú З
+CYR CAPIT I é И
+CYR CAPIT KA ë К
+CYR CAPIT EL ì Л
+CYR CAPIT EM í Ðœ
+CYR CAPIT EN î Ð
+CYR CAPIT O ï О
+CYR CAPIT PE ð П
+CYR CAPIT ER ò Р
+CYR CAPIT ES ó С
+CYR CAPIT TE ô Т
+CYR CAPIT U õ У
+CYR CAPIT EF æ Ф
+CYR CAPIT HA è Ð¥
+CYR CAPIT TSE ã Ц
+CYR CAPIT CHE þ Ч
+CYR CAPIT SHA û Ш
+CYR CAPIT SCHA ý Щ
+CYR CAPIT HARD SIGN ÿ Ъ
+CYR CAPIT YERU ù Ы
+CYR CAPIT SOFT SIGN ø Ь
+CYR CAPIT E ü Э
+CYR CAPIT YU à Ю
+CYR CAPIT YA ñ Я
+SELECT koi8_ru_f,MIN(comment) FROM t1 GROUP BY 1;
+koi8_ru_f MIN(comment)
+a LAT CAPIT A
+b LAT CAPIT B
+c LAT CAPIT C
+d LAT CAPIT D
+e LAT CAPIT E
+f LAT CAPIT F
+g LAT CAPIT G
+h LAT CAPIT H
+i LAT CAPIT I
+j LAT CAPIT J
+k LAT CAPIT K
+l LAT CAPIT L
+m LAT CAPIT M
+n LAT CAPIT N
+o LAT CAPIT O
+p LAT CAPIT P
+q LAT CAPIT Q
+r LAT CAPIT R
+s LAT CAPIT S
+t LAT CAPIT T
+u LAT CAPIT U
+v LAT CAPIT V
+w LAT CAPIT W
+x LAT CAPIT X
+y LAT CAPIT Y
+z LAT CAPIT Z
+Á CYR CAPIT A
+Â CYR CAPIT BE
+× CYR CAPIT VE
+Ç CYR CAPIT GE
+Ä CYR CAPIT DE
+Å CYR CAPIT IE
+£ CYR CAPIT IO
+Ö CYR CAPIT ZHE
+Ú CYR CAPIT ZE
+É CYR CAPIT I
+Ë CYR CAPIT KA
+Ì CYR CAPIT EL
+Í CYR CAPIT EM
+Î CYR CAPIT EN
+Ï CYR CAPIT O
+Ð CYR CAPIT PE
+Ò CYR CAPIT ER
+Ó CYR CAPIT ES
+Ô CYR CAPIT TE
+Õ CYR CAPIT U
+Æ CYR CAPIT EF
+È CYR CAPIT HA
+Ã CYR CAPIT TSE
+Þ CYR CAPIT CHE
+Û CYR CAPIT SHA
+Ý CYR CAPIT SCHA
+ß CYR CAPIT HARD SIGN
+Ù CYR CAPIT YERU
+Ø CYR CAPIT SOFT SIGN
+Ü CYR CAPIT E
+À CYR CAPIT YU
+Ñ CYR CAPIT YA
+SELECT utf8_f,MIN(comment) FROM t1 GROUP BY 1;
+utf8_f MIN(comment)
+a LAT CAPIT A
+b LAT CAPIT B
+c LAT CAPIT C
+d LAT CAPIT D
+e LAT CAPIT E
+f LAT CAPIT F
+g LAT CAPIT G
+h LAT CAPIT H
+i LAT CAPIT I
+j LAT CAPIT J
+k LAT CAPIT K
+l LAT CAPIT L
+m LAT CAPIT M
+n LAT CAPIT N
+o LAT CAPIT O
+p LAT CAPIT P
+q LAT CAPIT Q
+r LAT CAPIT R
+s LAT CAPIT S
+t LAT CAPIT T
+u LAT CAPIT U
+v LAT CAPIT V
+w LAT CAPIT W
+x LAT CAPIT X
+y LAT CAPIT Y
+z LAT CAPIT Z
+а CYR CAPIT A
+б CYR CAPIT BE
+в CYR CAPIT VE
+г CYR CAPIT GE
+д CYR CAPIT DE
+е CYR CAPIT IE
+ж CYR CAPIT ZHE
+з CYR CAPIT ZE
+и CYR CAPIT I
+к CYR CAPIT KA
+л CYR CAPIT EL
+м CYR CAPIT EM
+н CYR CAPIT EN
+о CYR CAPIT O
+п CYR CAPIT PE
+Ñ€ CYR CAPIT ER
+Ñ CYR CAPIT ES
+Ñ‚ CYR CAPIT TE
+у CYR CAPIT U
+Ñ„ CYR CAPIT EF
+Ñ… CYR CAPIT HA
+ц CYR CAPIT TSE
+ч CYR CAPIT CHE
+ш CYR CAPIT SHA
+щ CYR CAPIT SCHA
+ÑŠ CYR CAPIT HARD SIGN
+Ñ‹ CYR CAPIT YERU
+ь CYR CAPIT SOFT SIGN
+Ñ CYR CAPIT E
+ÑŽ CYR CAPIT YU
+Ñ CYR CAPIT YA
+SELECT DISTINCT koi8_ru_f FROM t1;
+koi8_ru_f
+a
+b
+c
+d
+e
+f
+g
+h
+i
+j
+k
+l
+m
+n
+o
+p
+q
+r
+s
+t
+u
+v
+w
+x
+y
+z
+SELECT DISTINCT utf8_f FROM t1;
+utf8_f
+a
+b
+c
+d
+e
+f
+g
+h
+i
+j
+k
+l
+m
+n
+o
+p
+q
+r
+s
+t
+u
+v
+w
+x
+y
+z
+а
+б
+в
+г
+д
+е
+ж
+з
+и
+к
+л
+м
+н
+о
+п
+Ñ€
+Ñ‚
+у
+Ñ„
+Ñ…
+ц
+ч
+ш
+щ
+ÑŠ
+Ñ‹
+ь
+ÑŽ
+SELECT lower(koi8_ru_f) FROM t1 ORDER BY 1 DESC;
+lower(koi8_ru_f)
+z
+z
+y
+y
+x
+x
+w
+w
+v
+v
+u
+u
+t
+t
+s
+s
+r
+r
+q
+q
+p
+p
+o
+o
+n
+n
+m
+m
+l
+l
+k
+k
+j
+j
+i
+i
+h
+h
+g
+g
+f
+f
+e
+e
+d
+d
+c
+c
+b
+b
+a
+a
+SELECT lower(utf8_f) FROM t1 ORDER BY 1 DESC;
+lower(utf8_f)
+ÑŽ
+ÑŽ
+ь
+ь
+Ñ‹
+Ñ‹
+ÑŠ
+ÑŠ
+щ
+щ
+ш
+ш
+ч
+ч
+ц
+ц
+Ñ…
+Ñ…
+Ñ„
+Ñ„
+у
+у
+Ñ‚
+Ñ‚
+Ñ€
+Ñ€
+п
+п
+о
+о
+н
+н
+м
+м
+л
+л
+к
+к
+и
+и
+з
+з
+ж
+ж
+е
+Ñ‘
+е
+Ñ‘
+д
+д
+г
+г
+в
+в
+б
+б
+а
+а
+z
+z
+y
+y
+x
+x
+w
+w
+v
+v
+u
+u
+t
+t
+s
+s
+r
+r
+q
+q
+p
+p
+o
+o
+n
+n
+m
+m
+l
+l
+k
+k
+j
+j
+i
+i
+h
+h
+g
+g
+f
+f
+e
+e
+d
+d
+c
+c
+b
+b
+a
+a
+SELECT t11.comment,t12.comment
+FROM t1 t11,t1 t12 WHERE CONVERT(t11.koi8_ru_f USING utf8)=t12.utf8_f
+ORDER BY t11.koi8_ru_f,t11.comment,t12.comment;
+comment comment
+LAT CAPIT A LAT CAPIT A
+LAT CAPIT A LAT SMALL A
+LAT SMALL A LAT CAPIT A
+LAT SMALL A LAT SMALL A
+LAT CAPIT B LAT CAPIT B
+LAT CAPIT B LAT SMALL B
+LAT SMALL B LAT CAPIT B
+LAT SMALL B LAT SMALL B
+LAT CAPIT C LAT CAPIT C
+LAT CAPIT C LAT SMALL C
+LAT SMALL C LAT CAPIT C
+LAT SMALL C LAT SMALL C
+LAT CAPIT D LAT CAPIT D
+LAT CAPIT D LAT SMALL D
+LAT SMALL D LAT CAPIT D
+LAT SMALL D LAT SMALL D
+LAT CAPIT E LAT CAPIT E
+LAT CAPIT E LAT SMALL E
+LAT SMALL E LAT CAPIT E
+LAT SMALL E LAT SMALL E
+LAT CAPIT F LAT CAPIT F
+LAT CAPIT F LAT SMALL F
+LAT SMALL F LAT CAPIT F
+LAT SMALL F LAT SMALL F
+LAT CAPIT G LAT CAPIT G
+LAT CAPIT G LAT SMALL G
+LAT SMALL G LAT CAPIT G
+LAT SMALL G LAT SMALL G
+LAT CAPIT H LAT CAPIT H
+LAT CAPIT H LAT SMALL H
+LAT SMALL H LAT CAPIT H
+LAT SMALL H LAT SMALL H
+LAT CAPIT I LAT CAPIT I
+LAT CAPIT I LAT SMALL I
+LAT SMALL I LAT CAPIT I
+LAT SMALL I LAT SMALL I
+LAT CAPIT J LAT CAPIT J
+LAT CAPIT J LAT SMALL J
+LAT SMALL J LAT CAPIT J
+LAT SMALL J LAT SMALL J
+LAT CAPIT K LAT CAPIT K
+LAT CAPIT K LAT SMALL K
+LAT SMALL K LAT CAPIT K
+LAT SMALL K LAT SMALL K
+LAT CAPIT L LAT CAPIT L
+LAT CAPIT L LAT SMALL L
+LAT SMALL L LAT CAPIT L
+LAT SMALL L LAT SMALL L
+LAT CAPIT M LAT CAPIT M
+LAT CAPIT M LAT SMALL M
+LAT SMALL M LAT CAPIT M
+LAT SMALL M LAT SMALL M
+LAT CAPIT N LAT CAPIT N
+LAT CAPIT N LAT SMALL N
+LAT SMALL N LAT CAPIT N
+LAT SMALL N LAT SMALL N
+LAT CAPIT O LAT CAPIT O
+LAT CAPIT O LAT SMALL O
+LAT SMALL O LAT CAPIT O
+LAT SMALL O LAT SMALL O
+LAT CAPIT P LAT CAPIT P
+LAT CAPIT P LAT SMALL P
+LAT SMALL P LAT CAPIT P
+LAT SMALL P LAT SMALL P
+LAT CAPIT Q LAT CAPIT Q
+LAT CAPIT Q LAT SMALL Q
+LAT SMALL Q LAT CAPIT Q
+LAT SMALL Q LAT SMALL Q
+LAT CAPIT R LAT CAPIT R
+LAT CAPIT R LAT SMALL R
+LAT SMALL R LAT CAPIT R
+LAT SMALL R LAT SMALL R
+LAT CAPIT S LAT CAPIT S
+LAT CAPIT S LAT SMALL S
+LAT SMALL S LAT CAPIT S
+LAT SMALL S LAT SMALL S
+LAT CAPIT T LAT CAPIT T
+LAT CAPIT T LAT SMALL T
+LAT SMALL T LAT CAPIT T
+LAT SMALL T LAT SMALL T
+LAT CAPIT U LAT CAPIT U
+LAT CAPIT U LAT SMALL U
+LAT SMALL U LAT CAPIT U
+LAT SMALL U LAT SMALL U
+LAT CAPIT V LAT CAPIT V
+LAT CAPIT V LAT SMALL V
+LAT SMALL V LAT CAPIT V
+LAT SMALL V LAT SMALL V
+LAT CAPIT W LAT CAPIT W
+LAT CAPIT W LAT SMALL W
+LAT SMALL W LAT CAPIT W
+LAT SMALL W LAT SMALL W
+LAT CAPIT X LAT CAPIT X
+LAT CAPIT X LAT SMALL X
+LAT SMALL X LAT CAPIT X
+LAT SMALL X LAT SMALL X
+LAT CAPIT Y LAT CAPIT Y
+LAT CAPIT Y LAT SMALL Y
+LAT SMALL Y LAT CAPIT Y
+LAT SMALL Y LAT SMALL Y
+LAT CAPIT Z LAT CAPIT Z
+LAT CAPIT Z LAT SMALL Z
+LAT SMALL Z LAT CAPIT Z
+LAT SMALL Z LAT SMALL Z
+CYR CAPIT A CYR CAPIT A
+CYR CAPIT A CYR SMALL A
+CYR SMALL A CYR CAPIT A
+CYR SMALL A CYR SMALL A
+CYR CAPIT BE CYR CAPIT BE
+CYR CAPIT BE CYR SMALL BE
+CYR SMALL BE CYR CAPIT BE
+CYR SMALL BE CYR SMALL BE
+CYR CAPIT VE CYR CAPIT VE
+CYR CAPIT VE CYR SMALL VE
+CYR SMALL VE CYR CAPIT VE
+CYR SMALL VE CYR SMALL VE
+CYR CAPIT GE CYR CAPIT GE
+CYR CAPIT GE CYR SMALL GE
+CYR SMALL GE CYR CAPIT GE
+CYR SMALL GE CYR SMALL GE
+CYR CAPIT DE CYR CAPIT DE
+CYR CAPIT DE CYR SMALL DE
+CYR SMALL DE CYR CAPIT DE
+CYR SMALL DE CYR SMALL DE
+CYR CAPIT IE CYR CAPIT IE
+CYR CAPIT IE CYR CAPIT IO
+CYR CAPIT IE CYR SMALL IE
+CYR CAPIT IE CYR SMALL IO
+CYR SMALL IE CYR CAPIT IE
+CYR SMALL IE CYR CAPIT IO
+CYR SMALL IE CYR SMALL IE
+CYR SMALL IE CYR SMALL IO
+CYR CAPIT IO CYR CAPIT IE
+CYR CAPIT IO CYR CAPIT IO
+CYR CAPIT IO CYR SMALL IE
+CYR CAPIT IO CYR SMALL IO
+CYR SMALL IO CYR CAPIT IE
+CYR SMALL IO CYR CAPIT IO
+CYR SMALL IO CYR SMALL IE
+CYR SMALL IO CYR SMALL IO
+CYR CAPIT ZHE CYR CAPIT ZHE
+CYR CAPIT ZHE CYR SMALL ZHE
+CYR SMALL ZHE CYR CAPIT ZHE
+CYR SMALL ZHE CYR SMALL ZHE
+CYR CAPIT ZE CYR CAPIT ZE
+CYR CAPIT ZE CYR SMALL ZE
+CYR SMALL ZE CYR CAPIT ZE
+CYR SMALL ZE CYR SMALL ZE
+CYR CAPIT I CYR CAPIT I
+CYR CAPIT I CYR SMALL I
+CYR SMALL I CYR CAPIT I
+CYR SMALL I CYR SMALL I
+CYR CAPIT KA CYR CAPIT KA
+CYR CAPIT KA CYR SMALL KA
+CYR SMALL KA CYR CAPIT KA
+CYR SMALL KA CYR SMALL KA
+CYR CAPIT EL CYR CAPIT EL
+CYR CAPIT EL CYR SMALL EL
+CYR SMALL EL CYR CAPIT EL
+CYR SMALL EL CYR SMALL EL
+CYR CAPIT EM CYR CAPIT EM
+CYR CAPIT EM CYR SMALL EM
+CYR SMALL EM CYR CAPIT EM
+CYR SMALL EM CYR SMALL EM
+CYR CAPIT EN CYR CAPIT EN
+CYR CAPIT EN CYR SMALL EN
+CYR SMALL EN CYR CAPIT EN
+CYR SMALL EN CYR SMALL EN
+CYR CAPIT O CYR CAPIT O
+CYR CAPIT O CYR SMALL O
+CYR SMALL O CYR CAPIT O
+CYR SMALL O CYR SMALL O
+CYR CAPIT PE CYR CAPIT PE
+CYR CAPIT PE CYR SMALL PE
+CYR SMALL PE CYR CAPIT PE
+CYR SMALL PE CYR SMALL PE
+CYR CAPIT ER CYR CAPIT ER
+CYR CAPIT ER CYR SMALL ER
+CYR SMALL ER CYR CAPIT ER
+CYR SMALL ER CYR SMALL ER
+CYR CAPIT ES CYR CAPIT ES
+CYR CAPIT ES CYR SMALL ES
+CYR SMALL ES CYR CAPIT ES
+CYR SMALL ES CYR SMALL ES
+CYR CAPIT TE CYR CAPIT TE
+CYR CAPIT TE CYR SMALL TE
+CYR SMALL TE CYR CAPIT TE
+CYR SMALL TE CYR SMALL TE
+CYR CAPIT U CYR CAPIT U
+CYR CAPIT U CYR SMALL U
+CYR SMALL U CYR CAPIT U
+CYR SMALL U CYR SMALL U
+CYR CAPIT EF CYR CAPIT EF
+CYR CAPIT EF CYR SMALL EF
+CYR SMALL EF CYR CAPIT EF
+CYR SMALL EF CYR SMALL EF
+CYR CAPIT HA CYR CAPIT HA
+CYR CAPIT HA CYR SMALL HA
+CYR SMALL HA CYR CAPIT HA
+CYR SMALL HA CYR SMALL HA
+CYR CAPIT TSE CYR CAPIT TSE
+CYR CAPIT TSE CYR SMALL TSE
+CYR SMALL TSE CYR CAPIT TSE
+CYR SMALL TSE CYR SMALL TSE
+CYR CAPIT CHE CYR CAPIT CHE
+CYR CAPIT CHE CYR SMALL CHE
+CYR SMALL CHE CYR CAPIT CHE
+CYR SMALL CHE CYR SMALL CHE
+CYR CAPIT SHA CYR CAPIT SHA
+CYR CAPIT SHA CYR SMALL SHA
+CYR SMALL SHA CYR CAPIT SHA
+CYR SMALL SHA CYR SMALL SHA
+CYR CAPIT SCHA CYR CAPIT SCHA
+CYR CAPIT SCHA CYR SMALL SCHA
+CYR SMALL SCHA CYR CAPIT SCHA
+CYR SMALL SCHA CYR SMALL SCHA
+CYR CAPIT HARD SIGN CYR CAPIT HARD SIGN
+CYR CAPIT HARD SIGN CYR SMALL HARD SIGN
+CYR SMALL HARD SIGN CYR CAPIT HARD SIGN
+CYR SMALL HARD SIGN CYR SMALL HARD SIGN
+CYR CAPIT YERU CYR CAPIT YERU
+CYR CAPIT YERU CYR SMALL YERU
+CYR SMALL YERU CYR CAPIT YERU
+CYR SMALL YERU CYR SMALL YERU
+CYR CAPIT SOFT SIGN CYR CAPIT SOFT SIGN
+CYR CAPIT SOFT SIGN CYR SMALL SOFT SIGN
+CYR SMALL SOFT SIGN CYR CAPIT SOFT SIGN
+CYR SMALL SOFT SIGN CYR SMALL SOFT SIGN
+CYR CAPIT E CYR CAPIT E
+CYR CAPIT E CYR SMALL E
+CYR SMALL E CYR CAPIT E
+CYR SMALL E CYR SMALL E
+CYR CAPIT YU CYR CAPIT YU
+CYR CAPIT YU CYR SMALL YU
+CYR SMALL YU CYR CAPIT YU
+CYR SMALL YU CYR SMALL YU
+CYR CAPIT YA CYR CAPIT YA
+CYR CAPIT YA CYR SMALL YA
+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)
+ORDER BY t12.utf8_f,t11.comment,t12.comment;
+comment comment
+LAT CAPIT A LAT CAPIT A
+LAT CAPIT A LAT SMALL A
+LAT SMALL A LAT CAPIT A
+LAT SMALL A LAT SMALL A
+LAT CAPIT B LAT CAPIT B
+LAT CAPIT B LAT SMALL B
+LAT SMALL B LAT CAPIT B
+LAT SMALL B LAT SMALL B
+LAT CAPIT C LAT CAPIT C
+LAT CAPIT C LAT SMALL C
+LAT SMALL C LAT CAPIT C
+LAT SMALL C LAT SMALL C
+LAT CAPIT D LAT CAPIT D
+LAT CAPIT D LAT SMALL D
+LAT SMALL D LAT CAPIT D
+LAT SMALL D LAT SMALL D
+LAT CAPIT E LAT CAPIT E
+LAT CAPIT E LAT SMALL E
+LAT SMALL E LAT CAPIT E
+LAT SMALL E LAT SMALL E
+LAT CAPIT F LAT CAPIT F
+LAT CAPIT F LAT SMALL F
+LAT SMALL F LAT CAPIT F
+LAT SMALL F LAT SMALL F
+LAT CAPIT G LAT CAPIT G
+LAT CAPIT G LAT SMALL G
+LAT SMALL G LAT CAPIT G
+LAT SMALL G LAT SMALL G
+LAT CAPIT H LAT CAPIT H
+LAT CAPIT H LAT SMALL H
+LAT SMALL H LAT CAPIT H
+LAT SMALL H LAT SMALL H
+LAT CAPIT I LAT CAPIT I
+LAT CAPIT I LAT SMALL I
+LAT SMALL I LAT CAPIT I
+LAT SMALL I LAT SMALL I
+LAT CAPIT J LAT CAPIT J
+LAT CAPIT J LAT SMALL J
+LAT SMALL J LAT CAPIT J
+LAT SMALL J LAT SMALL J
+LAT CAPIT K LAT CAPIT K
+LAT CAPIT K LAT SMALL K
+LAT SMALL K LAT CAPIT K
+LAT SMALL K LAT SMALL K
+LAT CAPIT L LAT CAPIT L
+LAT CAPIT L LAT SMALL L
+LAT SMALL L LAT CAPIT L
+LAT SMALL L LAT SMALL L
+LAT CAPIT M LAT CAPIT M
+LAT CAPIT M LAT SMALL M
+LAT SMALL M LAT CAPIT M
+LAT SMALL M LAT SMALL M
+LAT CAPIT N LAT CAPIT N
+LAT CAPIT N LAT SMALL N
+LAT SMALL N LAT CAPIT N
+LAT SMALL N LAT SMALL N
+LAT CAPIT O LAT CAPIT O
+LAT CAPIT O LAT SMALL O
+LAT SMALL O LAT CAPIT O
+LAT SMALL O LAT SMALL O
+LAT CAPIT P LAT CAPIT P
+LAT CAPIT P LAT SMALL P
+LAT SMALL P LAT CAPIT P
+LAT SMALL P LAT SMALL P
+LAT CAPIT Q LAT CAPIT Q
+LAT CAPIT Q LAT SMALL Q
+LAT SMALL Q LAT CAPIT Q
+LAT SMALL Q LAT SMALL Q
+LAT CAPIT R LAT CAPIT R
+LAT CAPIT R LAT SMALL R
+LAT SMALL R LAT CAPIT R
+LAT SMALL R LAT SMALL R
+LAT CAPIT S LAT CAPIT S
+LAT CAPIT S LAT SMALL S
+LAT SMALL S LAT CAPIT S
+LAT SMALL S LAT SMALL S
+LAT CAPIT T LAT CAPIT T
+LAT CAPIT T LAT SMALL T
+LAT SMALL T LAT CAPIT T
+LAT SMALL T LAT SMALL T
+LAT CAPIT U LAT CAPIT U
+LAT CAPIT U LAT SMALL U
+LAT SMALL U LAT CAPIT U
+LAT SMALL U LAT SMALL U
+LAT CAPIT V LAT CAPIT V
+LAT CAPIT V LAT SMALL V
+LAT SMALL V LAT CAPIT V
+LAT SMALL V LAT SMALL V
+LAT CAPIT W LAT CAPIT W
+LAT CAPIT W LAT SMALL W
+LAT SMALL W LAT CAPIT W
+LAT SMALL W LAT SMALL W
+LAT CAPIT X LAT CAPIT X
+LAT CAPIT X LAT SMALL X
+LAT SMALL X LAT CAPIT X
+LAT SMALL X LAT SMALL X
+LAT CAPIT Y LAT CAPIT Y
+LAT CAPIT Y LAT SMALL Y
+LAT SMALL Y LAT CAPIT Y
+LAT SMALL Y LAT SMALL Y
+LAT CAPIT Z LAT CAPIT Z
+LAT CAPIT Z LAT SMALL Z
+LAT SMALL Z LAT CAPIT Z
+LAT SMALL Z LAT SMALL Z
+CYR CAPIT A CYR CAPIT A
+CYR CAPIT A CYR SMALL A
+CYR SMALL A CYR CAPIT A
+CYR SMALL A CYR SMALL A
+CYR CAPIT BE CYR CAPIT BE
+CYR CAPIT BE CYR SMALL BE
+CYR SMALL BE CYR CAPIT BE
+CYR SMALL BE CYR SMALL BE
+CYR CAPIT VE CYR CAPIT VE
+CYR CAPIT VE CYR SMALL VE
+CYR SMALL VE CYR CAPIT VE
+CYR SMALL VE CYR SMALL VE
+CYR CAPIT GE CYR CAPIT GE
+CYR CAPIT GE CYR SMALL GE
+CYR SMALL GE CYR CAPIT GE
+CYR SMALL GE CYR SMALL GE
+CYR CAPIT DE CYR CAPIT DE
+CYR CAPIT DE CYR SMALL DE
+CYR SMALL DE CYR CAPIT DE
+CYR SMALL DE CYR SMALL DE
+CYR CAPIT IE CYR CAPIT IE
+CYR CAPIT IE CYR SMALL IE
+CYR CAPIT IO CYR CAPIT IO
+CYR CAPIT IO CYR SMALL IO
+CYR SMALL IE CYR CAPIT IE
+CYR SMALL IE CYR SMALL IE
+CYR SMALL IO CYR CAPIT IO
+CYR SMALL IO CYR SMALL IO
+CYR CAPIT ZHE CYR CAPIT ZHE
+CYR CAPIT ZHE CYR SMALL ZHE
+CYR SMALL ZHE CYR CAPIT ZHE
+CYR SMALL ZHE CYR SMALL ZHE
+CYR CAPIT ZE CYR CAPIT ZE
+CYR CAPIT ZE CYR SMALL ZE
+CYR SMALL ZE CYR CAPIT ZE
+CYR SMALL ZE CYR SMALL ZE
+CYR CAPIT I CYR CAPIT I
+CYR CAPIT I CYR SMALL I
+CYR SMALL I CYR CAPIT I
+CYR SMALL I CYR SMALL I
+CYR CAPIT KA CYR CAPIT KA
+CYR CAPIT KA CYR SMALL KA
+CYR SMALL KA CYR CAPIT KA
+CYR SMALL KA CYR SMALL KA
+CYR CAPIT EL CYR CAPIT EL
+CYR CAPIT EL CYR SMALL EL
+CYR SMALL EL CYR CAPIT EL
+CYR SMALL EL CYR SMALL EL
+CYR CAPIT EM CYR CAPIT EM
+CYR CAPIT EM CYR SMALL EM
+CYR SMALL EM CYR CAPIT EM
+CYR SMALL EM CYR SMALL EM
+CYR CAPIT EN CYR CAPIT EN
+CYR CAPIT EN CYR SMALL EN
+CYR SMALL EN CYR CAPIT EN
+CYR SMALL EN CYR SMALL EN
+CYR CAPIT O CYR CAPIT O
+CYR CAPIT O CYR SMALL O
+CYR SMALL O CYR CAPIT O
+CYR SMALL O CYR SMALL O
+CYR CAPIT PE CYR CAPIT PE
+CYR CAPIT PE CYR SMALL PE
+CYR SMALL PE CYR CAPIT PE
+CYR SMALL PE CYR SMALL PE
+CYR CAPIT ER CYR CAPIT ER
+CYR CAPIT ER CYR SMALL ER
+CYR SMALL ER CYR CAPIT ER
+CYR SMALL ER CYR SMALL ER
+CYR CAPIT ES CYR CAPIT ES
+CYR CAPIT ES CYR SMALL ES
+CYR SMALL ES CYR CAPIT ES
+CYR SMALL ES CYR SMALL ES
+CYR CAPIT TE CYR CAPIT TE
+CYR CAPIT TE CYR SMALL TE
+CYR SMALL TE CYR CAPIT TE
+CYR SMALL TE CYR SMALL TE
+CYR CAPIT U CYR CAPIT U
+CYR CAPIT U CYR SMALL U
+CYR SMALL U CYR CAPIT U
+CYR SMALL U CYR SMALL U
+CYR CAPIT EF CYR CAPIT EF
+CYR CAPIT EF CYR SMALL EF
+CYR SMALL EF CYR CAPIT EF
+CYR SMALL EF CYR SMALL EF
+CYR CAPIT HA CYR CAPIT HA
+CYR CAPIT HA CYR SMALL HA
+CYR SMALL HA CYR CAPIT HA
+CYR SMALL HA CYR SMALL HA
+CYR CAPIT TSE CYR CAPIT TSE
+CYR CAPIT TSE CYR SMALL TSE
+CYR SMALL TSE CYR CAPIT TSE
+CYR SMALL TSE CYR SMALL TSE
+CYR CAPIT CHE CYR CAPIT CHE
+CYR CAPIT CHE CYR SMALL CHE
+CYR SMALL CHE CYR CAPIT CHE
+CYR SMALL CHE CYR SMALL CHE
+CYR CAPIT SHA CYR CAPIT SHA
+CYR CAPIT SHA CYR SMALL SHA
+CYR SMALL SHA CYR CAPIT SHA
+CYR SMALL SHA CYR SMALL SHA
+CYR CAPIT SCHA CYR CAPIT SCHA
+CYR CAPIT SCHA CYR SMALL SCHA
+CYR SMALL SCHA CYR CAPIT SCHA
+CYR SMALL SCHA CYR SMALL SCHA
+CYR CAPIT HARD SIGN CYR CAPIT HARD SIGN
+CYR CAPIT HARD SIGN CYR SMALL HARD SIGN
+CYR SMALL HARD SIGN CYR CAPIT HARD SIGN
+CYR SMALL HARD SIGN CYR SMALL HARD SIGN
+CYR CAPIT YERU CYR CAPIT YERU
+CYR CAPIT YERU CYR SMALL YERU
+CYR SMALL YERU CYR CAPIT YERU
+CYR SMALL YERU CYR SMALL YERU
+CYR CAPIT SOFT SIGN CYR CAPIT SOFT SIGN
+CYR CAPIT SOFT SIGN CYR SMALL SOFT SIGN
+CYR SMALL SOFT SIGN CYR CAPIT SOFT SIGN
+CYR SMALL SOFT SIGN CYR SMALL SOFT SIGN
+CYR CAPIT E CYR CAPIT E
+CYR CAPIT E CYR SMALL E
+CYR SMALL E CYR CAPIT E
+CYR SMALL E CYR SMALL E
+CYR CAPIT YU CYR CAPIT YU
+CYR CAPIT YU CYR SMALL YU
+CYR SMALL YU CYR CAPIT YU
+CYR SMALL YU CYR SMALL YU
+CYR CAPIT YA CYR CAPIT YA
+CYR CAPIT YA CYR SMALL YA
+CYR SMALL YA CYR CAPIT YA
+CYR SMALL YA CYR SMALL YA
+ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2 NOT NULL;
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0394,'GREEK CAPIT DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0395,'GREEK CAPIT EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B1,'GREEK SMALL ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B2,'GREEK SMALL BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B3,'GREEK SMALL GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B4,'GREEK SMALL DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B5,'GREEK SMALL EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0531,'ARMENIAN CAPIT AYB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0532,'ARMENIAN CAPIT BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0533,'ARMENIAN CAPIT GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0534,'ARMENIAN CAPIT DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0535,'ARMENIAN CAPIT ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0536,'ARMENIAN CAPIT ZA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0561,'ARMENIAN SMALL YAB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0562,'ARMENIAN SMALL BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0563,'ARMENIAN SMALL GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0564,'ARMENIAN SMALL DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0565,'ARMENIAN SMALL ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0566,'ARMENIAN SMALL ZA');
+ALTER TABLE t1 ADD armscii8_f CHAR(32) CHARACTER SET armscii8 NOT NULL;
+ALTER TABLE t1 ADD greek_f CHAR(32) CHARACTER SET greek NOT NULL;
+UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE 'GRE%';
+UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE 'ARM%';
+UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f='';
+UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f='';
+SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
+min(comment) count(*)
+LAT CAPIT A 2
+LAT CAPIT B 2
+LAT CAPIT C 2
+LAT CAPIT D 2
+LAT CAPIT E 2
+LAT CAPIT F 2
+LAT CAPIT G 2
+LAT CAPIT H 2
+LAT CAPIT I 2
+LAT CAPIT J 2
+LAT CAPIT K 2
+LAT CAPIT L 2
+LAT CAPIT M 2
+LAT CAPIT N 2
+LAT CAPIT O 2
+LAT CAPIT P 2
+LAT CAPIT Q 2
+LAT CAPIT R 2
+LAT CAPIT S 2
+LAT CAPIT T 2
+LAT CAPIT U 2
+LAT CAPIT V 2
+LAT CAPIT W 2
+LAT CAPIT X 2
+LAT CAPIT Y 2
+LAT CAPIT Z 2
+GREEK CAPIT ALPHA 2
+GREEK CAPIT BETA 2
+GREEK CAPIT GAMMA 2
+GREEK CAPIT DELTA 2
+GREEK CAPIT EPSILON 2
+CYR CAPIT A 2
+CYR CAPIT BE 2
+CYR CAPIT VE 2
+CYR CAPIT GE 2
+CYR CAPIT DE 2
+CYR CAPIT IE 4
+CYR CAPIT ZHE 2
+CYR CAPIT ZE 2
+CYR CAPIT I 2
+CYR CAPIT KA 2
+CYR CAPIT EL 2
+CYR CAPIT EM 2
+CYR CAPIT EN 2
+CYR CAPIT O 2
+CYR CAPIT PE 2
+CYR CAPIT ER 2
+CYR CAPIT ES 2
+CYR CAPIT TE 2
+CYR CAPIT U 2
+CYR CAPIT EF 2
+CYR CAPIT HA 2
+CYR CAPIT TSE 2
+CYR CAPIT CHE 2
+CYR CAPIT SHA 2
+CYR CAPIT SCHA 2
+CYR CAPIT HARD SIGN 2
+CYR CAPIT YERU 2
+CYR CAPIT SOFT SIGN 2
+CYR CAPIT E 2
+CYR CAPIT YU 2
+CYR CAPIT YA 2
+ARMENIAN CAPIT AYB 2
+ARMENIAN CAPIT BEN 2
+ARMENIAN CAPIT GIM 2
+ARMENIAN CAPIT DA 2
+ARMENIAN CAPIT ECH 2
+ARMENIAN CAPIT ZA 2
+DROP TABLE t1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
new file mode 100644
index 00000000000..204ca86f306
--- /dev/null
+++ b/mysql-test/r/derived.result
@@ -0,0 +1,67 @@
+drop table if exists t1,t2,t3;
+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);
+insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
+select t1.a,t3.y from t1,(select a as y from t2 where b='c') as t3 where t1.a = t3.y;
+a y
+3 3
+3 3
+select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.a;
+a a
+3 3
+3 3
+CREATE TABLE t3 (a int not null, b char (10) not null);
+insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
+select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
+a y
+3 3
+3 3
+SELECT a FROM (SELECT 1 FROM (SELECT 1) HAVING a=1);
+Unknown column 'a' in 'having clause'
+SELECT a,b as a FROM (SELECT '1' as a,'2' as b) HAVING a=1;
+Column: 'a' in having clause is ambiguous
+SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=2;
+a a
+1 2
+SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=1;
+a a
+SELECT 1 FROM (SELECT 1) WHERE a=2;
+Unknown column 'a' in 'where clause'
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
+Unknown column 'a' in 'having clause'
+drop table if exists t1.t2,t3;
+select * from (select 1);
+1
+1
+select a from (select 1 as a);
+a
+1
+select 1 from (select 1);
+1
+1
+drop table if exists t1;
+create table t1(a int not null, t char(8), index(a));
+SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
+a t
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+10 10
+11 11
+12 12
+13 13
+14 14
+15 15
+16 16
+17 17
+18 18
+19 19
+20 20
+drop table if exists t1;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 10a00995c9e..fec5ece8ddf 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -172,10 +172,10 @@ b
INSERT INTO t2 values (1),(2),(3);
INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
-table type possible_keys key key_len ref rows Extra
-t3 index a a 5 NULL 6 Using index; Using temporary
-t2 index a a 4 NULL 5 Using index; Distinct
-t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index a a 5 NULL 6 Using index; Using temporary
+1 SIMPLE t2 index a a 4 NULL 5 Using index; Distinct
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
@@ -188,9 +188,9 @@ insert into t3 select * from t4;
insert into t4 select * from t3;
insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
-t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
+1 SIMPLE t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
@@ -274,14 +274,14 @@ on j_lj_t3.id=t3_lj.id
WHERE
((t1.id=j_lj_t2.id AND t2_lj.id IS NULL) OR (t1.id=t2.id AND t2.idx=2))
AND ((t1.id=j_lj_t3.id AND t3_lj.id IS NULL) OR (t1.id=t3.id AND t3.idx=2));
-table type possible_keys key key_len ref rows Extra
-t1 index id id 4 NULL 2 Using index; Using temporary
-t2 index id id 8 NULL 1 Using index; Distinct
-t3 index id id 8 NULL 1 Using index; Distinct
-j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
-t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
-j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
-t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index id id 4 NULL 2 Using index; Using temporary
+1 SIMPLE t2 index id id 8 NULL 1 Using index; Distinct
+1 SIMPLE t3 index id id 8 NULL 1 Using index; Distinct
+1 SIMPLE j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
+1 SIMPLE t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
+1 SIMPLE j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
+1 SIMPLE t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
diff --git a/mysql-test/r/explain.result b/mysql-test/r/explain.result
index 876846a5236..dafed9a7d41 100644
--- a/mysql-test/r/explain.result
+++ b/mysql-test/r/explain.result
@@ -9,22 +9,22 @@ select * from t1 where str="foo";
id str
3 foo
explain select * from t1 where str is null;
-table type possible_keys key key_len ref rows Extra
-t1 ref str str 11 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref str str 11 const 1 Using where
explain select * from t1 where str="foo";
-table type possible_keys key key_len ref rows Extra
-t1 const str str 11 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const str str 11 const 1
explain select * from t1 ignore key (str) where str="foo";
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
explain select * from t1 use key (str,str) where str="foo";
-table type possible_keys key key_len ref rows Extra
-t1 const str str 11 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const str str 11 const 1
explain select * from t1 use key (str,str,foo) where str="foo";
Key column 'foo' doesn't exist in table
explain select * from t1 ignore key (str,str,foo) where str="foo";
Key column 'foo' doesn't exist in table
drop table t1;
explain select 1;
-Comment
-No tables used
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE No tables used
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index edf109fcc93..a991981bf21 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -141,10 +141,10 @@ show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`ticket` int(11) default NULL,
- `inhalt` text,
+ `inhalt` text character set latin1,
KEY `tig` (`ticket`),
FULLTEXT KEY `tix` (`inhalt`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
select * from t2 where MATCH inhalt AGAINST (NULL);
ticket inhalt
select * from t2 where MATCH inhalt AGAINST ('foobar');
diff --git a/mysql-test/r/func_system.result b/mysql-test/r/func_system.result
index 5ea4ed5e4e0..83c2ad6e020 100644
--- a/mysql-test/r/func_system.result
+++ b/mysql-test/r/func_system.result
@@ -4,3 +4,6 @@ test 1
select version()>="3.23.29";
version()>="3.23.29"
1
+select TRUE,FALSE,NULL;
+TRUE FALSE NULL
+1 0 NULL
diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result
index 8cfae44b9dd..9fcf03db838 100644
--- a/mysql-test/r/func_test.result
+++ b/mysql-test/r/func_test.result
@@ -46,6 +46,9 @@ select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
0 1 1 0 NULL NULL NULL
+select 10 % 7, 10 mod 7, 10 div 3;
+10 % 7 10 mod 7 10 div 3
+3 3 3
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
0 1
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 0e8c6520d5c..86a8eb2dd22 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -225,19 +225,19 @@ key (score)
);
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
select userid,count(*) from t1 group by userid desc;
userid count(*)
3 3
2 1
1 2
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
-table type possible_keys key key_len ref rows Extra
-t1 range spID spID 5 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
-table type possible_keys key key_len ref rows Extra
-t1 range spID spID 5 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range spID spID 5 NULL 2 Using where; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*)
1 1
@@ -247,8 +247,8 @@ spid count(*)
2 2
1 1
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
select sql_big_result spid,sum(userid) from t1 group by spid desc;
spid sum(userid)
5 3
@@ -257,8 +257,8 @@ spid sum(userid)
2 3
1 1
explain select sql_big_result score,count(*) from t1 group by score desc;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL score 3 NULL 6 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL score 3 NULL 6 Using index
select sql_big_result score,count(*) from t1 group by score desc;
score count(*)
3 3
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 73642d7f751..ffd62ceabb6 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -65,10 +65,10 @@ a
869751
alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
-table type possible_keys key key_len ref rows Extra
-t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1;
-create table t1 (x int not null, y int not null, key x(x), unique y(y))
+create table t1 (x int not null, y int not null, key x (x), unique y (y))
type=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
select * from t1 where x=1;
@@ -84,9 +84,9 @@ x y x y
2 5 2 2
2 6 2 2
explain select * from t1,t1 as t2 where t1.x=t2.y;
-table type possible_keys key key_len ref rows Extra
-t1 ALL x NULL NULL NULL 6
-t2 eq_ref y y 4 t1.x 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 t1.x 1
drop table t1;
create table t1 (a int) type=heap;
insert into t1 values(1);
@@ -158,18 +158,18 @@ drop table t1;
create table t1 (btn char(10) not null, key(btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
-table type possible_keys key key_len ref rows Extra
-t1 ALL btn NULL NULL NULL 14 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
-table type possible_keys key key_len ref rows Extra
-t1 ALL btn NULL NULL NULL 14 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
-table type possible_keys key key_len ref rows Extra
-t1 ref btn btn 11 const,const 10 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -181,16 +181,16 @@ INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 5 const 10 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 10 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ref b b 5 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
diff --git a/mysql-test/r/heap_auto_increment.result b/mysql-test/r/heap_auto_increment.result
new file mode 100644
index 00000000000..9a5ed57d741
--- /dev/null
+++ b/mysql-test/r/heap_auto_increment.result
@@ -0,0 +1,41 @@
+drop table if exists t1;
+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;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+a b
+1 1
+3 3
+5 5
+6 6
+delete from t1 where a=6;
+replace t1 values (3,1);
+ALTER TABLE t1 add c int;
+replace t1 values (3,3,3);
+insert into t1 values (NULL,7,7);
+update t1 set a=8,b=b+1,c=c+1 where a=7;
+insert into t1 values (NULL,9,9);
+select * from t1;
+a b c
+1 1 NULL
+3 3 3
+5 5 NULL
+8 8 8
+9 9 9
+drop table t1;
+create table t1 (
+skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
+sval char(20)
+) type=heap;
+insert into t1 values (NULL, "hello");
+insert into t1 values (NULL, "hey");
+select * from t1;
+skey sval
+1 hello
+2 hey
+select _rowid,t1._rowid,skey,sval from t1;
+_rowid _rowid skey sval
+1 1 1 hello
+2 2 2 hey
+drop table t1;
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
new file mode 100644
index 00000000000..a33f237a312
--- /dev/null
+++ b/mysql-test/r/heap_btree.result
@@ -0,0 +1,235 @@
+drop table if exists t1;
+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;
+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 a A NULL NULL NULL BTREE
+select * from t1;
+a b
+2 2
+3 3
+4 4
+select * from t1 where a=4;
+a b
+4 4
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+a b
+2 2
+3 3
+4 6
+alter table t1 add c int not null, add key using BTREE (c,a);
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > 0;
+select * from t1;
+a b
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 4
+drop table t1;
+create table t1 (a int not null) type=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+a
+869751
+802616
+alter table t1 add unique uniq_id using BTREE (a);
+select * from t1 where a > 736494;
+a
+802616
+869751
+select * from t1 where a = 736494;
+a
+736494
+select * from t1 where a=869751 or a=736494;
+a
+736494
+869751
+select * from t1 where a in (869751,736494,226312,802616);
+a
+226312
+736494
+802616
+869751
+alter table t1 type=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+drop table t1;
+create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
+type=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+explain select * from t1 where x=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref x x 4 const 1 where used
+select * from t1 where x=1;
+x y
+1 1
+1 3
+select * from t1,t1 as t2 where t1.x=t2.y;
+x y x y
+1 1 1 1
+2 2 2 2
+1 3 1 1
+2 4 2 2
+2 5 2 2
+2 6 2 2
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 t1.x 1
+drop table t1;
+create table t1 (a int) type=heap;
+insert into t1 values(1);
+select max(a) from t1;
+max(a)
+1
+drop table t1;
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) TYPE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 1
+1 2
+1 3
+1 4
+1 5
+1 6
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 1
+1 1
+1 2
+1 2
+1 3
+1 3
+1 4
+1 4
+1 5
+1 5
+1 6
+1 6
+explain select * from tx where a=x order by a,b;
+id select_type table type possible_keys key key_len ref rows Extra
+x SIMPLE tx ref a a x const x where used
+explain select * from tx where a=x order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+x SIMPLE tx ref a a x const x where used
+select * from t1 where b=1;
+a b
+1 1
+1 1
+explain select * from tx where b=x;
+id select_type table type possible_keys key key_len ref rows Extra
+x SIMPLE tx ref b b x const x where used
+drop table t1;
+create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+max(id)
+1
+insert into t1 values(2);
+select max(id) from t1;
+max(id)
+2
+replace into t1 values(1);
+drop table t1;
+create table t1 (n int) type=heap;
+drop table t1;
+create table t1 (n int) type=heap;
+drop table if exists t1;
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) type=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+f1 f2
+16 ted
+12 ted
+12 ted
+12 ted
+12 ted
+drop table t1;
+create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "q%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
+select * from t1 where btn like "q%";
+btn
+alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
+update t1 set new_col=btn;
+explain select * from t1 where btn="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 10 const 1 where used
+explain select * from t1 where btn="a" and new_col="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 11 const,const 1 where used
+drop table t1;
+CREATE TABLE t1 (
+a int default NULL,
+b int default NULL,
+KEY a using BTREE (a),
+UNIQUE b using BTREE (b)
+) type=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+a b
+explain SELECT * FROM t1 WHERE a IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 1 where used
+SELECT * FROM t1 WHERE a<=>NULL;
+a b
+NULL 99
+SELECT * FROM t1 WHERE b=NULL;
+a b
+explain SELECT * FROM t1 WHERE b IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 1 where used
+SELECT * FROM t1 WHERE b<=>NULL;
+a b
+99 NULL
+INSERT INTO t1 VALUES (1,3);
+Duplicate entry '3' for key 1
+DROP TABLE t1;
+CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) type=heap;
+INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
+SELECT * FROM t1 WHERE a=1 and b IS NULL;
+a b c
+1 NULL NULL
+1 NULL 1
+SELECT * FROM t1 WHERE a=1 and c IS NULL;
+a b c
+1 NULL NULL
+1 1 NULL
+SELECT * FROM t1 WHERE a=1 and b IS NULL and c IS NULL;
+a b c
+1 NULL NULL
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null, primary key using BTREE (a)) type=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+a
+DROP TABLE t1;
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
new file mode 100644
index 00000000000..43a86069d3d
--- /dev/null
+++ b/mysql-test/r/heap_hash.result
@@ -0,0 +1,205 @@
+drop table if exists t1;
+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;
+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 a NULL NULL NULL NULL HASH
+select * from t1;
+a b
+2 2
+3 3
+4 4
+select * from t1 where a=4;
+a b
+4 4
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+a b
+2 2
+3 3
+4 6
+alter table t1 add c int not null, add key using HASH (c,a);
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > 0;
+select * from t1;
+a b
+drop table t1;
+create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+select * from t1;
+a b
+1 1
+2 2
+3 3
+4 4
+drop table t1;
+create table t1 (a int not null) type=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+a
+869751
+802616
+alter table t1 add unique uniq_id using HASH (a);
+select * from t1 where a > 736494;
+a
+869751
+802616
+select * from t1 where a = 736494;
+a
+736494
+select * from t1 where a=869751 or a=736494;
+a
+736494
+869751
+select * from t1 where a in (869751,736494,226312,802616);
+a
+226312
+736494
+802616
+869751
+alter table t1 type=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
+drop table t1;
+create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
+type=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+select * from t1 where x=1;
+x y
+1 3
+1 1
+select * from t1,t1 as t2 where t1.x=t2.y;
+x y x y
+1 1 1 1
+2 2 2 2
+1 3 1 1
+2 4 2 2
+2 5 2 2
+2 6 2 2
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL x NULL NULL NULL 6
+1 SIMPLE t2 eq_ref y y 4 t1.x 1
+drop table t1;
+create table t1 (a int) type=heap;
+insert into t1 values(1);
+select max(a) from t1;
+max(a)
+1
+drop table t1;
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) TYPE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+a b
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+1 6
+1 5
+1 4
+1 3
+1 2
+1 1
+drop table t1;
+create table t1 (id int unsigned not null, primary key using HASH (id)) type=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+max(id)
+1
+insert into t1 values(2);
+select max(id) from t1;
+max(id)
+2
+replace into t1 values(1);
+drop table t1;
+create table t1 (n int) type=heap;
+drop table t1;
+create table t1 (n int) type=heap;
+drop table if exists t1;
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) type=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+f1 f2
+16 ted
+12 ted
+12 ted
+12 ted
+12 ted
+drop table t1;
+create table t1 (btn char(10) not null, key using HASH (btn)) type=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "q%";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
+select * from t1 where btn like "q%";
+btn
+alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
+update t1 set new_col=btn;
+explain select * from t1 where btn="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL btn NULL NULL NULL 14 where used
+explain select * from t1 where btn="a" and new_col="a";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref btn btn 11 const,const 10 where used
+drop table t1;
+CREATE TABLE t1 (
+a int default NULL,
+b int default NULL,
+KEY a using HASH (a),
+UNIQUE b using HASH (b)
+) type=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+a b
+explain SELECT * FROM t1 WHERE a IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 10 where used
+SELECT * FROM t1 WHERE a<=>NULL;
+a b
+NULL 99
+SELECT * FROM t1 WHERE b=NULL;
+a b
+explain SELECT * FROM t1 WHERE b IS NULL;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref b b 5 const 1 where used
+SELECT * FROM t1 WHERE b<=>NULL;
+a b
+99 NULL
+INSERT INTO t1 VALUES (1,3);
+Duplicate entry '3' for key 1
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null, primary key using HASH (a)) type=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+a
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 67c78f34392..81064143872 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -139,14 +139,14 @@ id parent_id level
1010 102 2
1015 102 2
explain select level from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 12 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 12 Using where; Using index
explain select level,id from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 12 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 12 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 12 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 12 Using where
select level,id from t1 where level=1;
level id
1 1002
@@ -596,8 +596,8 @@ id parent_id level
1025 102 2
1016 102 2
explain select level from t1 where level=1;
-table type possible_keys key key_len ref rows Extra
-t1 ref level level 1 const 6 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const 6 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
@@ -758,8 +758,8 @@ DROP TABLE t1;
create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) type = innodb;
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);
explain select * from t1 where a > 0 and a < 50;
-table type possible_keys key key_len ref rows Extra
-t1 range PRIMARY PRIMARY 4 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where
drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
@@ -805,9 +805,9 @@ 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) default NULL,
+ `a` char(20) character set latin1 default NULL,
KEY `a` (`a`)
-) TYPE=InnoDB
+) TYPE=InnoDB CHARSET=latin1
drop table t1;
create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb;
insert into t1 values (NULL),(NULL),(NULL);
@@ -892,29 +892,29 @@ drop table t1;
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=innodb;
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4
explain select * from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 4
explain select * from t1 order by c;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a from t1 order by a;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain select b from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b,c from t1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1;
create table t1 (t int not null default 1, key (t)) type=innodb;
desc t1;
diff --git a/mysql-test/r/isam.result b/mysql-test/r/isam.result
index 0f7224f52da..e8f7898f1eb 100644
--- a/mysql-test/r/isam.result
+++ b/mysql-test/r/isam.result
@@ -67,10 +67,10 @@ a int(11) PRI 0
b int(11) MUL 0
c int(11) 0
show full columns from t1;
-Field Type Null Key Default Extra Privileges
-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 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
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 37e18b8b304..700b73d3eca 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -90,12 +90,12 @@ grp a c id a c d
2 3 c NULL NULL NULL NULL
NULL NULL NULL NULL NULL NULL
explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
-Comment
-Impossible WHERE noticed after reading const tables
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Impossible WHERE noticed after reading const tables
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 7
-t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 7
+1 SIMPLE t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 Using where
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
grp a c id a c d a
1 1 a 1 1 a 1 1
@@ -311,13 +311,13 @@ select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where
name name id
Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t1 left join t2 on (t1.id = t2.owner);
count(*)
4
@@ -331,13 +331,13 @@ select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where
name name id
Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3
-t2 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+1 SIMPLE t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t2 right join t1 on (t1.id = t2.owner);
count(*)
4
@@ -618,9 +618,9 @@ UNIQUE id (id,idx)
);
INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 2
-t2 index id id 8 NULL 1 Using where; Using index; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2
+1 SIMPLE t2 index id id 8 NULL 1 Using where; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
@@ -638,9 +638,9 @@ create table t2 (fooID smallint unsigned not null, barID smallint unsigned not n
insert into t1 (fooID) values (10),(20),(30);
insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
-table type possible_keys key key_len ref rows Extra
-t2 index NULL PRIMARY 4 NULL 3 Using index
-t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL PRIMARY 4 NULL 3 Using index
+1 SIMPLE t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
diff --git a/mysql-test/r/key_diff.result b/mysql-test/r/key_diff.result
index 4eaccc696f9..8097186bde1 100644
--- a/mysql-test/r/key_diff.result
+++ b/mysql-test/r/key_diff.result
@@ -34,9 +34,9 @@ C c a a
D E a a
a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
-table type possible_keys key key_len ref rows Extra
-t1 ALL a NULL NULL NULL 5
-t2 ALL b NULL NULL NULL 5 Using where
+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 b NULL NULL NULL 5 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
diff --git a/mysql-test/r/key_primary.result b/mysql-test/r/key_primary.result
index 87289f1cf54..e148548b721 100644
--- a/mysql-test/r/key_primary.result
+++ b/mysql-test/r/key_primary.result
@@ -12,9 +12,9 @@ select * from t1 where t1 like "a_\%";
t1
AB%
describe select * from t1 where t1="ABC";
-table type possible_keys key key_len ref rows Extra
-t1 const PRIMARY PRIMARY 3 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 3 const 1
describe select * from t1 where t1="ABCD";
-Comment
-Impossible WHERE noticed after reading const tables
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Impossible WHERE noticed after reading const tables
drop table t1;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index f7e692d1c7b..45b5bd9ddb7 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -34,11 +34,11 @@ insert into t2 select NULL,message from t1;
insert into t1 select NULL,message from t2;
create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
-table type possible_keys key key_len ref rows Extra
-t3 range a a 4 NULL 18 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 range a a 4 NULL 10 Using where
explain select * from t3 where a > 10 and a < 20;
-table type possible_keys key key_len ref rows Extra
-t3 range a a 4 NULL 16 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 range a a 4 NULL 10 Using where
select * from t3 where a = 10;
a b
10 Testing
@@ -84,8 +84,8 @@ a b
19 Testing
19 Testing
explain select a from t3 order by a desc limit 10;
-table type possible_keys key key_len ref rows Extra
-t3 index NULL a 4 NULL 1131 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index NULL a 4 NULL 1131 Using index
select a from t3 order by a desc limit 10;
a
699
@@ -172,9 +172,9 @@ show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0',
- `b` char(20) default NULL,
+ `b` char(20) character set latin1 default NULL,
KEY `a` (`a`)
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) 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);
select * from t4;
Can't open file: 't4.MRG'. (errno: 143)
@@ -249,14 +249,14 @@ t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0',
`othr` int(11) NOT NULL default '0',
PRIMARY KEY (`incr`)
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
alter table t3 drop primary key;
show create table t3;
Table Create Table
t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0',
`othr` int(11) NOT NULL default '0'
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
drop table t3,t2,t1;
create table t1 (a int not null) type=merge;
select * from t1;
@@ -287,28 +287,28 @@ t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
show create table t4;
Table Create Table
t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MRG_MyISAM UNION=(t1,t2)
+) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2)
show create table t5;
Table Create Table
t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`)
-) TYPE=MRG_MyISAM INSERT_METHOD=FIRST UNION=(t1,t2)
+) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=FIRST UNION=(t1,t2)
show create table t6;
Table Create Table
t6 CREATE TABLE `t6` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`)
-) TYPE=MRG_MyISAM INSERT_METHOD=LAST UNION=(t1,t2)
+) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=LAST UNION=(t1,t2)
insert into t1 values (1,NULL),(1,NULL),(1,NULL),(1,NULL);
insert into t2 values (2,NULL),(2,NULL),(2,NULL),(2,NULL);
select * from t3 order by b,a limit 3;
@@ -373,7 +373,7 @@ t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MRG_MyISAM UNION=(t1,t2,t3)
+) TYPE=MRG_MyISAM CHARSET=latin1 UNION=(t1,t2,t3)
select * from t4 order by a,b;
a b
1 1
@@ -399,7 +399,7 @@ t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0',
`b` int(11) NOT NULL default '0',
KEY `a` (`a`,`b`)
-) TYPE=MRG_MyISAM INSERT_METHOD=FIRST UNION=(t1,t2,t3)
+) TYPE=MRG_MyISAM CHARSET=latin1 INSERT_METHOD=FIRST UNION=(t1,t2,t3)
insert into t4 values (4,1),(4,2);
select * from t1 order by a,b;
a b
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 4a0eb47efb7..6b9c3a53305 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -1,7 +1,7 @@
drop table if exists t1;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
-KEY STRING_DATA (STRING_DATA)
+KEY string_data (STRING_DATA)
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
INSERT INTO t1 VALUES ('DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD');
@@ -51,29 +51,29 @@ drop table t1;
create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) type=myisam;
insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
explain select * from t1 order by a;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select * from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select * from t1 order by c;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a from t1 order by a;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL PRIMARY 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index
explain select b from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL b 4 NULL 4 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL 4 Using index
explain select a,b from t1 order by b;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4 Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
explain select a,b from t1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
explain select a,b,c from t1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 4
drop table t1;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1), (2), (3);
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index ce397e11c1a..85687df411b 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/r/null_key.result
@@ -2,38 +2,38 @@ drop table if exists t1;
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;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 5 const 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 9 const,const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a is null and b = 7;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 9 const,const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 const a,b a 9 const,const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const a,b a 9 const,const 1
explain select * from t1 where a<=>b limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 9 NULL 12 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 9 NULL 12 Using where; Using index
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 9 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b b 4 const 2 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b b 4 const 2 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 9 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 9 NULL 2 Using where; Using index
explain select * from t1 where a > 1 and a < 3 limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
explain select * from t1 where a > 8 and a < 9;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where; Using index
select * from t1 where a is null;
a b
NULL 7
@@ -65,44 +65,44 @@ NULL 9
NULL 9
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 2 and c=0;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 7 and c=0;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a=2 and b = 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 1 Using where
explain select * from t1 where a<=>b limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 12 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 12 Using where
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 5 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 5 NULL 5 Using where
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
-table type possible_keys key key_len ref rows Extra
-t1 ref a,b a 5 const 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a > 1 and a < 3 limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
-table type possible_keys key key_len ref rows Extra
-t1 range a,b a 5 NULL 4 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where a > 8 and a < 9;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 5 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 1 Using where
explain select * from t1 where b like "6%";
-table type possible_keys key key_len ref rows Extra
-t1 range b b 12 NULL 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range b b 12 NULL 1 Using where
select * from t1 where a is null;
a b c
NULL 7 0
@@ -151,11 +151,11 @@ PRIMARY KEY (id)
INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
-table type possible_keys key key_len ref rows Extra
-t1 ref idx1 idx1 5 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref idx1 idx1 5 const 1 Using where
explain select id from t1 where uniq_id =1;
-table type possible_keys key key_len ref rows Extra
-t1 const idx1 idx1 5 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const idx1 idx1 5 const 1
UPDATE t1 SET id=id+100 where uniq_id is null;
UPDATE t2 SET id=id+100 where uniq_id is null;
select id from t1 where uniq_id is null;
diff --git a/mysql-test/r/odbc.result b/mysql-test/r/odbc.result
index 5aa163a663e..498147704a3 100644
--- a/mysql-test/r/odbc.result
+++ b/mysql-test/r/odbc.result
@@ -11,6 +11,6 @@ a b
select * from t1 where a is null;
a b
explain select * from t1 where b is null;
-Comment
-Impossible WHERE noticed after reading const tables
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Impossible WHERE noticed after reading const tables
drop table t1;
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 48773bfa916..5645961a178 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -263,14 +263,14 @@ drop table t1;
create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 20 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 20 NULL 2 Using where; Using index
select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
a b c
1 NULL b
explain select * from t1 where a >= 1 and a < 3 order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 10 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 10 Using where; Using index
select * from t1 where a >= 1 and a < 3 order by a desc;
a b c
2 3 c
@@ -285,8 +285,8 @@ a b c
1 NULL b
1 NULL NULL
explain select * from t1 where a = 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 4 const 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 4 const 5 Using where; Using index
select * from t1 where a = 1 order by a desc, b desc;
a b c
1 3 b
@@ -296,35 +296,35 @@ a b c
1 NULL b
1 NULL NULL
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
select * from t1 where a = 1 and b is null order by a desc, b desc;
a b c
1 NULL NULL
1 NULL b
explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 8 Using where; Using index; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 8 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 6 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 6 Using where; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 9 NULL 2 Using where; Using index; Using filesort
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 9 NULL 2 Using where; Using index; Using filesort
alter table t1 modify b int not null, modify c varchar(10) not null;
explain select * from t1 order by a, b, c;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 18 NULL 11 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 18 NULL 11 Using index
select * from t1 order by a, b, c;
a b c
1 0
@@ -339,8 +339,8 @@ a b c
2 2 b
2 3 c
explain select * from t1 order by a desc, b desc, c desc;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL a 18 NULL 11 Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL a 18 NULL 11 Using index
select * from t1 order by a desc, b desc, c desc;
a b c
2 3 c
@@ -355,15 +355,15 @@ a b c
1 0 b
1 0
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 18 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 18 NULL 3 Using where; Using index
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
a b c
1 1 b
1 1 b
explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 6 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 6 Using where; Using index
select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
a b c
1 1 b
@@ -386,8 +386,8 @@ a b c
1 1 b
1 1
explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 8 NULL 10 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 8 NULL 10 Using where; Using index
select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
a b c
2 1 b
@@ -398,8 +398,8 @@ a b c
1 0 b
1 0
explain select * from t1 where a between 0 and 1 order by a desc, b desc;
-table type possible_keys key key_len ref rows Extra
-t1 range a a 4 NULL 5 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 4 NULL 5 Using where; Using index
select * from t1 where a between 0 and 1 order by a desc, b desc;
a b c
1 3 b
@@ -449,27 +449,27 @@ gid sid uid
104505 5 117
103853 5 250
EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and t2.uid = t3.uid order by t1.gid, t3.uid;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
+1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 6 Using index
-t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
-t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
+1 SIMPLE t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
-table type possible_keys key key_len ref rows Extra
-t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
-t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
-t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 Using where
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index a1d258455dc..a3663416bc8 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -15,8 +15,8 @@ event_date type event_id
1999-07-13 100600 26
1999-07-14 100600 10
explain select event_date,type,event_id from t1 WHERE type = 100601 and event_date >= "1999-07-01" AND event_date < "1999-07-15" AND (type=100600 OR type=100100) ORDER BY event_date;
-Comment
-Impossible WHERE
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Impossible WHERE
select event_date,type,event_id from t1 WHERE event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND (type=100600 OR type=100100) or event_date >= "1999-07-01" AND event_date <= "1999-07-15" AND type=100099;
event_date type event_id
1999-07-10 100100 24
@@ -193,7 +193,7 @@ INSERT INTO t1 (art) VALUES ('j'),('J'),('j'),('J'),('j'),('J'),('j'),('J'),('j'
('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j'),('j');
select count(*) from t1 where upper(art) = 'J';
count(*)
-602
+213
select count(*) from t1 where art = 'J' or art = 'j';
count(*)
602
diff --git a/mysql-test/r/rollback.result b/mysql-test/r/rollback.result
index a5eb6f8729f..d87aa68dce4 100644
--- a/mysql-test/r/rollback.result
+++ b/mysql-test/r/rollback.result
@@ -4,9 +4,26 @@ begin work;
insert into t1 values (4);
insert into t1 values (5);
rollback;
-Warning: Some non-transactional changed tables couldn't be rolled back
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+select @@warning_count;
+@@warning_count
+1
+select @@error_count;
+@@error_count
+0
+show warnings;
+Level Code Message
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+show errors;
+Level Code Message
select * from t1;
n
4
5
+select @@warning_count;
+@@warning_count
+0
+show warnings;
+Level Code Message
drop table t1;
diff --git a/mysql-test/r/rpl000001.result b/mysql-test/r/rpl000001.result
index 2dc21e86152..5cee2e6deff 100644
--- a/mysql-test/r/rpl000001.result
+++ b/mysql-test/r/rpl000001.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+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;
@@ -30,9 +30,9 @@ abandoned
abandoning
abandonment
abandons
-slave stop;
+stop slave;
set password for root@"localhost" = password('foo');
-slave start;
+start slave;
set password for root@"localhost" = password('');
create table t3(n int);
insert into t3 values(1),(2);
@@ -45,13 +45,13 @@ sum(length(word))
141
drop table t1,t3;
reset master;
-slave stop;
+stop slave;
reset slave;
create table t1(n int);
select get_lock("hold_slave",10);
get_lock("hold_slave",10)
1
-slave start;
+start slave;
select release_lock("hold_slave");
release_lock("hold_slave")
1
@@ -68,7 +68,7 @@ kill @id;
drop table t2;
Server shutdown in progress
set global sql_slave_skip_counter=1;
-slave start;
+start slave;
select count(*) from t1;
count(*)
5000
diff --git a/mysql-test/r/rpl000002.result b/mysql-test/r/rpl000002.result
index 4c2b3bdfde6..819f43da103 100644
--- a/mysql-test/r/rpl000002.result
+++ b/mysql-test/r/rpl000002.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1;
create table t1 (n int auto_increment primary key);
set insert_id = 2000;
@@ -17,7 +17,7 @@ show slave hosts;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 9999 2 1
drop table t1;
-slave stop;
+stop slave;
drop table if exists t2;
create table t2(id int auto_increment primary key, created datetime);
set timestamp=12345;
@@ -25,7 +25,7 @@ insert into t2 set created=now();
select * from t2;
id created
1 1970-01-01 06:25:45
-slave start;
+start slave;
select * from t2;
id created
1 1970-01-01 06:25:45
diff --git a/mysql-test/r/rpl000003.result b/mysql-test/r/rpl000003.result
index b123b3d98c5..7c63ada9cdf 100644
--- a/mysql-test/r/rpl000003.result
+++ b/mysql-test/r/rpl000003.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1;
create table t1(n int primary key);
insert into t1 values (1),(2),(2);
diff --git a/mysql-test/r/rpl000004.result b/mysql-test/r/rpl000004.result
index 82b208d0b58..a677eac36d4 100644
--- a/mysql-test/r/rpl000004.result
+++ b/mysql-test/r/rpl000004.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
set SQL_LOG_BIN=0;
drop table if exists t1;
create table t1 (word char(20) not null, index(word));
diff --git a/mysql-test/r/rpl000005.result b/mysql-test/r/rpl000005.result
index 3e9028bf2cf..228bb00a1a3 100644
--- a/mysql-test/r/rpl000005.result
+++ b/mysql-test/r/rpl000005.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1;
CREATE TABLE t1 (name varchar(64), age smallint(3));
INSERT INTO t1 SET name='Andy', age=31;
diff --git a/mysql-test/r/rpl000006.result b/mysql-test/r/rpl000006.result
index e7fc5151ac4..e256e0f0136 100644
--- a/mysql-test/r/rpl000006.result
+++ b/mysql-test/r/rpl000006.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
set SQL_LOG_BIN=0,timestamp=200006;
drop table if exists t1;
create table t1(t timestamp not null,a char(1));
diff --git a/mysql-test/r/rpl000008.result b/mysql-test/r/rpl000008.result
index a0230d55702..eb0089da9d6 100644
--- a/mysql-test/r/rpl000008.result
+++ b/mysql-test/r/rpl000008.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
use test;
drop table if exists foo;
create table foo (n int);
diff --git a/mysql-test/r/rpl000009.result b/mysql-test/r/rpl000009.result
index afd566c366c..1a1ea309ae9 100644
--- a/mysql-test/r/rpl000009.result
+++ b/mysql-test/r/rpl000009.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop database if exists foo;
create database foo;
drop database if exists bar;
diff --git a/mysql-test/r/rpl000010.result b/mysql-test/r/rpl000010.result
index 49538ed148e..6b6b89d1547 100644
--- a/mysql-test/r/rpl000010.result
+++ b/mysql-test/r/rpl000010.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1;
drop table if exists t1;
create table t1 (n int not null auto_increment primary key);
diff --git a/mysql-test/r/rpl000011.result b/mysql-test/r/rpl000011.result
index 5d22c29bdba..bb017076822 100644
--- a/mysql-test/r/rpl000011.result
+++ b/mysql-test/r/rpl000011.result
@@ -1,14 +1,14 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1;
create table t1 (n int);
insert into t1 values(1);
-slave stop;
-slave start;
+stop slave;
+start slave;
insert into t1 values(2);
select * from t1;
n
diff --git a/mysql-test/r/rpl000012.result b/mysql-test/r/rpl000012.result
index 45de6502bbd..f809fa7fe74 100644
--- a/mysql-test/r/rpl000012.result
+++ b/mysql-test/r/rpl000012.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1,t2,t3;
create table t2 (n int);
create temporary table t1 (n int);
diff --git a/mysql-test/r/rpl000013.result b/mysql-test/r/rpl000013.result
index 9e802da59c5..333d769baff 100644
--- a/mysql-test/r/rpl000013.result
+++ b/mysql-test/r/rpl000013.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t2;
create table t2(n int);
create temporary table t1 (n int);
diff --git a/mysql-test/r/rpl000015.result b/mysql-test/r/rpl000015.result
index 7010349e5ff..349365e17ad 100644
--- a/mysql-test/r/rpl000015.result
+++ b/mysql-test/r/rpl000015.result
@@ -1,23 +1,23 @@
reset master;
show master status;
File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 79
+master-bin.000001 79
reset 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
change master to master_host='127.0.0.1';
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 test MASTER_PORT 7 4 slave-relay-bin.001 4 No No 0 0 0 4
+127.0.0.1 test MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
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 7 4 slave-relay-bin.001 4 No No 0 0 0 4
-slave start;
+127.0.0.1 root MASTER_PORT 7 4 slave-relay-bin.000001 4 No No 0 0 0 4
+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 7 master-bin.001 79 slave-relay-bin.001 120 master-bin.001 Yes Yes 0 0 79 120
+127.0.0.1 root MASTER_PORT 7 master-bin.000001 79 slave-relay-bin.000001 123 master-bin.000001 Yes Yes 0 0 79 123
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
diff --git a/mysql-test/r/rpl000017.result b/mysql-test/r/rpl000017.result
index bac0573165d..64e13042e9c 100644
--- a/mysql-test/r/rpl000017.result
+++ b/mysql-test/r/rpl000017.result
@@ -1,7 +1,7 @@
reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
-slave start;
+start slave;
drop table if exists t1;
create table t1(n int);
insert into t1 values(24);
diff --git a/mysql-test/r/rpl000018.result b/mysql-test/r/rpl000018.result
index ba51406bba0..7211d440524 100644
--- a/mysql-test/r/rpl000018.result
+++ b/mysql-test/r/rpl000018.result
@@ -1,9 +1,9 @@
reset slave;
-slave start;
-show master logs;
+start slave;
+show binary logs;
Log_name
-master-bin.001
-master-bin.002
+master-bin.000001
+master-bin.000002
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
diff --git a/mysql-test/r/rpl_alter.result b/mysql-test/r/rpl_alter.result
index 1dc73c6524a..0b947c0bb70 100644
--- a/mysql-test/r/rpl_alter.result
+++ b/mysql-test/r/rpl_alter.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop database if exists d1;
create database d1;
create table d1.t1 ( n int);
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
index 19e2bf28dcd..267806feb2e 100644
--- a/mysql-test/r/rpl_empty_master_crash.result
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+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
diff --git a/mysql-test/r/rpl_failsafe.result b/mysql-test/r/rpl_failsafe.result
index 14b749fada9..d122b13adc2 100644
--- a/mysql-test/r/rpl_failsafe.result
+++ b/mysql-test/r/rpl_failsafe.result
@@ -1,8 +1,8 @@
-slave stop;
+stop slave;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-slave start;
+start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 1
@@ -17,14 +17,14 @@ rpl_recovery_rank 2
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
-slave start;
+start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 3
show status like 'Rpl_status';
Variable_name Value
Rpl_status ACTIVE_SLAVE
-slave start;
+start slave;
show variables like 'rpl_recovery_rank';
Variable_name Value
rpl_recovery_rank 4
diff --git a/mysql-test/r/rpl_flush_log_loop.result b/mysql-test/r/rpl_flush_log_loop.result
index da2930f30c3..98d661e9af2 100644
--- a/mysql-test/r/rpl_flush_log_loop.result
+++ b/mysql-test/r/rpl_flush_log_loop.result
@@ -1,17 +1,17 @@
-slave stop;
+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;
-slave start;
+start slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
-slave start;
-slave stop;
+start slave;
+stop slave;
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=SLAVE_PORT;
-slave start;
+start slave;
flush logs;
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 SLAVE_PORT 60 slave-bin.001 79 relay-log.001 119 slave-bin.001 Yes Yes 0 0 79 119
+127.0.0.1 root SLAVE_PORT 60 slave-bin.000001 79 relay-log.000001 122 slave-bin.000001 Yes Yes 0 0 79 122
diff --git a/mysql-test/r/rpl_get_lock.result b/mysql-test/r/rpl_get_lock.result
index a8e602be03f..369fde7ef8f 100644
--- a/mysql-test/r/rpl_get_lock.result
+++ b/mysql-test/r/rpl_get_lock.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
create table t1(n int);
insert into t1 values(get_lock("lock",2));
select get_lock("lock",2);
diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result
index 835b5d6629a..a5850cbd181 100644
--- a/mysql-test/r/rpl_log.result
+++ b/mysql-test/r/rpl_log.result
@@ -1,10 +1,10 @@
-slave stop;
+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;
-slave start;
-slave stop;
+start slave;
+stop slave;
reset master;
reset slave;
reset master;
@@ -16,77 +16,77 @@ load data infile '../../std_data/words.dat' into table t1;
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
-master-bin.001 172 Intvar 1 172 INSERT_ID=1
-master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
-master-bin.001 263 Query 1 263 use test; drop table t1
-master-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
-master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
-master-bin.001 556 Exec_load 1 556 ;file_id=1
-master-bin.001 579 Query 1 579 use test; drop table t1
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Intvar 1 172 INSERT_ID=1
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+master-bin.000001 263 Query 1 263 use `test`; drop table t1
+master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
+master-bin.000001 556 Exec_load 1 556 ;file_id=1
+master-bin.000001 579 Query 1 579 use `test`; drop table t1
show binlog events from 79 limit 1;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
show binlog events from 79 limit 2;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
-master-bin.001 172 Intvar 1 172 INSERT_ID=1
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Intvar 1 172 INSERT_ID=1
show binlog events from 79 limit 2,1;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
flush logs;
-slave start;
+start slave;
flush logs;
-slave stop;
+stop slave;
create table t1 (n int);
insert into t1 values (1);
drop table t1;
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
-master-bin.001 172 Intvar 1 172 INSERT_ID=1
-master-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
-master-bin.001 263 Query 1 263 use test; drop table t1
-master-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
-master-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
-master-bin.001 556 Exec_load 1 556 ;file_id=1
-master-bin.001 579 Query 1 579 use test; drop table t1
-master-bin.001 627 Rotate 1 627 master-bin.002;pos=4
-show binlog events in 'master-bin.002';
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+master-bin.000001 172 Intvar 1 172 INSERT_ID=1
+master-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+master-bin.000001 263 Query 1 263 use `test`; drop table t1
+master-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
+master-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
+master-bin.000001 556 Exec_load 1 556 ;file_id=1
+master-bin.000001 579 Query 1 579 use `test`; drop table t1
+master-bin.000001 627 Rotate 1 627 master-bin.000002;pos=4
+show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.002 4 Query 1 4 use test; create table t1 (n int)
-master-bin.002 62 Query 1 62 use test; insert into t1 values (1)
-master-bin.002 122 Query 1 122 use test; drop table t1
-show master logs;
+master-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
+master-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
+master-bin.000002 122 Query 1 122 use `test`; drop table t1
+show binary logs;
Log_name
-master-bin.001
-master-bin.002
-slave start;
-show master logs;
+master-bin.000001
+master-bin.000002
+start slave;
+show binary logs;
Log_name
-slave-bin.001
-slave-bin.002
-show binlog events in 'slave-bin.001' from 4;
+slave-bin.000001
+slave-bin.000002
+show binlog events in 'slave-bin.000001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
-slave-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
-slave-bin.001 172 Intvar 1 172 INSERT_ID=1
-slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
-slave-bin.001 263 Query 1 263 use test; drop table t1
-slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
-slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
-slave-bin.001 565 Exec_load 1 556 ;file_id=1
-slave-bin.001 588 Query 1 579 use test; drop table t1
-slave-bin.001 636 Rotate 2 636 slave-bin.002;pos=4
-show binlog events in 'slave-bin.002' from 4;
+slave-bin.000001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
+slave-bin.000001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
+slave-bin.000001 172 Intvar 1 200 INSERT_ID=1
+slave-bin.000001 200 Query 1 200 use `test`; insert into t1 values (NULL)
+slave-bin.000001 263 Query 1 263 use `test`; drop table t1
+slave-bin.000001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
+slave-bin.000001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
+slave-bin.000001 565 Exec_load 1 556 ;file_id=1
+slave-bin.000001 588 Query 1 579 use `test`; drop table t1
+slave-bin.000001 636 Rotate 2 636 slave-bin.000002;pos=4
+show binlog events in 'slave-bin.000002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
-slave-bin.002 4 Query 1 4 use test; create table t1 (n int)
-slave-bin.002 62 Query 1 62 use test; insert into t1 values (1)
-slave-bin.002 122 Query 1 122 use test; drop table t1
+slave-bin.000002 4 Query 1 4 use `test`; create table t1 (n int)
+slave-bin.000002 62 Query 1 62 use `test`; insert into t1 values (1)
+slave-bin.000002 122 Query 1 122 use `test`; drop table 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
-127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961
-show binlog events in 'slave-bin.005' from 4;
+127.0.0.1 root MASTER_PORT 1 master-bin.000002 170 slave-relay-bin.000002 969 master-bin.000002 Yes Yes 0 0 170 973
+show binlog events in 'slave-bin.000005' from 4;
Error when executing command SHOW BINLOG EVENTS: Could not find target log
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index 6883da76180..b4dc132e046 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -1,39 +1,39 @@
-slave stop;
+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;
-slave start;
+start slave;
show master status;
File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 79
+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.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124
+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
change master to master_log_pos=73;
-slave stop;
+stop slave;
change master to master_log_pos=73;
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.001 73 slave-relay-bin.001 4 master-bin.001 No No 0 0 73 4
-slave start;
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 73 4
+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.001 73 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 73 4
+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
change master to master_log_pos=173;
-slave start;
+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.001 173 slave-relay-bin.001 4 master-bin.001 No Yes 0 0 173 4
+127.0.0.1 root MASTER_PORT 1 master-bin.000001 173 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 173 4
show master status;
File Position Binlog_do_db Binlog_ignore_db
-master-bin.001 79
+master-bin.000001 79
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);
change master to master_log_pos=79;
-slave start;
+start slave;
select * from t1;
n
1
diff --git a/mysql-test/r/rpl_mystery22.result b/mysql-test/r/rpl_mystery22.result
index 5dd665fe9d5..348b3211cd5 100644
--- a/mysql-test/r/rpl_mystery22.result
+++ b/mysql-test/r/rpl_mystery22.result
@@ -1,20 +1,20 @@
-slave stop;
+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;
-slave start;
+start slave;
create table t1(n int auto_increment primary key);
insert into t1 values (2);
insert into t1 values(NULL);
insert into t1 values(NULL);
delete from t1 where n = 2;
-slave start;
-slave stop;
+start slave;
+stop slave;
create table t2(n int);
drop table t2;
insert into t1 values(NULL);
-slave start;
+start slave;
select * from t1;
n
1
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
index 6103a075684..66c94a00b5f 100644
--- a/mysql-test/r/rpl_redirect.result
+++ b/mysql-test/r/rpl_redirect.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+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
SHOW SLAVE HOSTS;
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index 372d8c07f64..aabda54640c 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t11;
drop table if exists t11;
create table t2 (n int);
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index 741c53fe52b..2582b875daa 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -1,22 +1,22 @@
drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4;
-slave start;
+start slave;
Could not initialize master info structure, check permisions on master.info
-slave start;
+start slave;
Could not initialize master info structure, check permisions on master.info
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
Could not initialize master info
reset slave;
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
reset master;
-slave start;
+start slave;
create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
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 60 master-bin.001 417 slave-relay-bin.001 458 master-bin.001 Yes Yes 0 0 417 458
+127.0.0.1 root MASTER_PORT 60 master-bin.000001 417 slave-relay-bin.000001 461 master-bin.000001 Yes Yes 0 0 417 461
select * from t1;
s
Could not break slave
@@ -26,11 +26,11 @@ 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;
-show master logs;
+show binary logs;
Log_name
-master-bin.001
-master-bin.002
-master-bin.003
+master-bin.000001
+master-bin.000002
+master-bin.000003
create table t3 select * from temp_table;
select * from t3;
a
@@ -40,15 +40,15 @@ insert into t2 values(1234);
set insert_id=1234;
insert into t2 values(NULL);
set global sql_slave_skip_counter=1;
-slave start;
-purge master logs to 'master-bin.003';
-show master logs;
+start slave;
+purge master logs to 'master-bin.000003';
+show binary logs;
Log_name
-master-bin.003
+master-bin.000003
insert into t2 values (65);
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 60 master-bin.003 290 slave-relay-bin.001 1073 master-bin.003 Yes Yes 0 0 290 1073
+127.0.0.1 root MASTER_PORT 60 master-bin.000003 290 slave-relay-bin.000001 1088 master-bin.000003 Yes Yes 0 0 290 1088
select * from t2;
m
34
@@ -61,21 +61,21 @@ 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 master logs;
+show binary logs;
Log_name
-master-bin.003
-master-bin.004
-master-bin.005
-master-bin.006
+master-bin.000003
+master-bin.000004
+master-bin.000005
+master-bin.000006
show master status;
File Position Binlog_do_db Binlog_ignore_db
-master-bin.006 838
+master-bin.000006 838
select * from t4;
a
testing temporary tables part 2
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 60 master-bin.006 838 slave-relay-bin.001 8034 master-bin.006 Yes Yes 0 0 838 8034
+127.0.0.1 root MASTER_PORT 60 master-bin.000006 838 slave-relay-bin.000001 8067 master-bin.000006 Yes Yes 0 0 838 8067
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_skip_error.result b/mysql-test/r/rpl_skip_error.result
index 946d64ad7c5..91aae09001f 100644
--- a/mysql-test/r/rpl_skip_error.result
+++ b/mysql-test/r/rpl_skip_error.result
@@ -1,9 +1,9 @@
-slave stop;
+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;
-slave start;
+start slave;
drop table if exists t1;
create table t1 (n int not null primary key);
insert into t1 values (1);
diff --git a/mysql-test/r/rpl_sporadic_master.result b/mysql-test/r/rpl_sporadic_master.result
index a6a58515f0a..789c3bf2b2b 100644
--- a/mysql-test/r/rpl_sporadic_master.result
+++ b/mysql-test/r/rpl_sporadic_master.result
@@ -1,16 +1,16 @@
-slave stop;
+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;
-slave start;
+start slave;
create table t2(n int);
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL);
truncate table t1;
insert into t1 values (4),(NULL);
-slave stop;
-slave start;
+stop slave;
+start slave;
insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index fdcc7f9cdea..2615ee542e3 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1327,20 +1327,20 @@ fld3
select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ref fld3 fld3 30 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ref fld3 fld3 30 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
-table type possible_keys key key_len ref rows Extra
-t2 ref fld3 fld3 30 const 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
@@ -1350,8 +1350,8 @@ fld3
honeysuckle
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
-table type possible_keys key key_len ref rows Extra
-t2 range fld3 fld3 30 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld3 fld3 30 NULL 2 Using where; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
@@ -1370,8 +1370,8 @@ fld1
250501
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
-table type possible_keys key key_len ref rows Extra
-t2 range fld1 fld1 4 NULL 2 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 2 Using where; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
250501
@@ -1379,8 +1379,8 @@ fld1
250505
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
-table type possible_keys key key_len ref rows Extra
-t2 range fld1 fld1 4 NULL 4 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
218401 faithful
@@ -1806,21 +1806,21 @@ companynr rtrim(space(512+companynr))
select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by fld3;
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
-table type possible_keys key key_len ref rows Extra
-t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
-t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
+1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
-table type possible_keys key key_len ref rows Extra
-t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
-t3 ref period period 4 t1.period 4181
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
+1 SIMPLE t3 ref period period 4 t1.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
-table type possible_keys key key_len ref rows Extra
-t3 index period period 4 NULL 41810
-t1 ref period period 4 t3.period 4181
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 index period period 4 NULL 41810
+1 SIMPLE t1 ref period period 4 t3.period 4181
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
-table type possible_keys key key_len ref rows Extra
-t1 index period period 4 NULL 41810
-t3 ref period period 4 t1.period 4181
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index period period 4 NULL 41810
+1 SIMPLE t3 ref period period 4 t1.period 4181
select period from t1;
period
9410
@@ -1833,9 +1833,9 @@ select fld3,period from t2,t3 where t2.fld1 = 011401 and t2.fld1=t3.t2nr and t3.
fld3 period
breaking 1001
explain select fld3,period from t2,t3 where t2.fld1 = 011401 and t3.t2nr=t2.fld1 and 1001 = t3.period;
-table type possible_keys key key_len ref rows Extra
-t2 const fld1 fld1 4 const 1
-t3 const PRIMARY,period PRIMARY 4 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 const fld1 fld1 4 const 1
+1 SIMPLE t3 const PRIMARY,period PRIMARY 4 const 1
select fld3,period from t2,t1 where companynr*10 = 37*10;
fld3 period
breaking 9410
@@ -2573,21 +2573,21 @@ fld1 fld1
select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
companynr companyname
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199
-t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
+1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
-table type possible_keys key key_len ref rows Extra
-t4 ALL NULL NULL NULL NULL 12
-t2 ALL NULL NULL NULL NULL 1199 Using where; Not exists
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t4 ALL NULL NULL NULL NULL 12
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where; Not exists
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
41 40
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199 Using temporary
-t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary
+1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
@@ -3096,11 +3096,11 @@ select t2.fld1,sum(price) from t3,t2 where t2.fld1 = t3.t2nr and t3.companynr =
fld1 sum(price)
038008 234298
explain select fld3 from t2 where 1>2 or 2>3;
-Comment
-Impossible WHERE
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Impossible WHERE
explain select fld3 from t2 where fld1=fld1;
-table type possible_keys key key_len ref rows Extra
-t2 ALL NULL NULL NULL NULL 1199
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ALL NULL NULL NULL NULL 1199
select companynr,fld1 from t2 HAVING fld1=250501 or fld1=250502;
companynr fld1
34 250501
@@ -3151,8 +3151,8 @@ select count(*) from t3 where companynr=512 and price2=76234234;
count(*)
4181
explain select min(fld1),max(fld1),count(*) from t2;
-Comment
-Select tables optimized away
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Select tables optimized away
select min(fld1),max(fld1),count(*) from t2;
min(fld1) max(fld1) count(*)
0 1232609 1199
@@ -3219,23 +3219,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
-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) MUL select,insert,update,references
-fld4 char(35) select,insert,update,references
-fld5 char(35) select,insert,update,references
-fld6 char(4) select,insert,update,references
+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
show full columns from t2 from test like 'f%';
-Field Type Null Key Default Extra Privileges
-fld1 int(6) unsigned zerofill UNI 000000 select,insert,update,references
-fld3 char(30) MUL select,insert,update,references
-fld4 char(35) select,insert,update,references
-fld5 char(35) select,insert,update,references
-fld6 char(4) select,insert,update,references
+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
show full columns from t2 from test like 's%';
-Field Type Null Key Default Extra Privileges
+Field Type 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
@@ -3266,6 +3266,16 @@ select wss_type from t1 where wss_type =102935229216544093;
wss_type
102935229216544093
drop table t1;
+select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
+select @a;
+@a
+3
+select @b;
+@b
+aaaa
+select @c;
+@c
+6.26
create table t1 (a int not null auto_increment primary key);
insert into t1 values ();
insert into t1 values ();
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 1c2cd7da894..8500e244d08 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -168,4 +168,24 @@ test2 2 2
SELECT FOUND_ROWS();
FOUND_ROWS()
2
+SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
+1
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+1
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+2
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+3
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
+titre numeropost maxnumrep
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+3
drop table t1;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 2c32d766a38..2e8d7d19465 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -43,7 +43,7 @@ wait_timeout 28800
show variables like "this_doesn't_exists%";
Variable_name Value
show table status from test like "this_doesn't_exists%";
-Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Create_options Comment
+Name Type Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Charset Create_options Comment
show databases;
Database
mysql
@@ -77,24 +77,31 @@ show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
alter table t1 rename t2;
show create table t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0'
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
-name char(20) default 'O''Brien'
+name char(20) default 'O''Brien' comment 'O''Brien as default',
+c int not null comment 'int column'
) comment = 'it\'s a table' ;
show create table t1 ;
Table Create Table
t1 CREATE TABLE `t1` (
- `test_set` set('val1','val2','val3') NOT NULL default '',
- `name` char(20) default 'O''Brien'
-) TYPE=MyISAM COMMENT='it''s a table'
+ `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',
+ `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
drop table t1;
create table t1 (a int not null, unique aa (a));
show create table t1;
@@ -102,7 +109,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
UNIQUE KEY `aa` (`a`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
drop table t1;
create table t1 (a int not null, primary key (a));
show create table t1;
@@ -110,7 +117,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
drop table t1;
flush tables;
show open tables;
@@ -126,25 +133,25 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
- `b` char(10) default NULL,
+ `b` char(10) character set latin1 default NULL,
KEY `b` (`b`)
-) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
+) 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;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
- `b` varchar(10) default NULL,
+ `b` varchar(10) character set latin1 default NULL,
KEY `b` (`b`)
-) TYPE=MyISAM MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
+) 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;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0',
- `b` varchar(10) default NULL,
+ `b` varchar(10) character set latin1 default NULL,
KEY `b` (`b`)
-) TYPE=MyISAM
+) 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;
@@ -155,6 +162,14 @@ e double(9,2) YES NULL
f double(5,0) YES NULL
h float(3,2) YES NULL
i float(3,0) 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
drop table t1;
create table t1 (c decimal, d double, f float, r real);
show columns from t1;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
new file mode 100644
index 00000000000..e54e1fb0fef
--- /dev/null
+++ b/mysql-test/r/subselect.result
@@ -0,0 +1,291 @@
+select (select 2);
+(select 2)
+2
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+(SELECT 1)
+1
+2
+SELECT (SELECT (SELECT 0 UNION SELECT 0));
+(SELECT (SELECT 0 UNION SELECT 0))
+0
+SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
+Cyclic reference on subqueries
+SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
+Cyclic reference on subqueries
+drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
+create table t1 (a int);
+create table t2 (a int, b int);
+create table t3 (a int);
+create table t4 (a int, b int);
+insert into t1 values (2);
+insert into t2 values (1,7),(2,7);
+insert into t4 values (4,8),(3,8),(5,9);
+select (select a from t1 where t1.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a) a
+NULL 1
+2 2
+select (select a from t1 where t1.a=t2.b), a from t2;
+(select a from t1 where t1.a=t2.b) a
+NULL 1
+NULL 2
+select (select a from t1), a from t2;
+(select a from t1) a
+2 1
+2 2
+select (select a from t3), a from t2;
+(select a from t3) a
+NULL 1
+NULL 2
+select * from t2 where t2.a=(select a from t1);
+a b
+2 7
+insert into t3 values (6),(7),(3);
+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)
+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)
+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)
+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 where used
+2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 Using filesort
+3 UNION t4 ALL NULL NULL NULL NULL 3 where used; Using filesort
+4 SUBSELECT t2 ALL NULL NULL NULL NULL 2
+select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
+(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
+3 1
+7 2
+select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+(select t3.a from t3 where a<8 order by 1 desc limit 1) a
+7 2
+explain select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived3> system NULL NULL NULL NULL 1
+3 DERIVED t2 ALL NULL NULL NULL NULL 2 where used
+2 SUBSELECT t3 ALL NULL NULL NULL NULL 3 where used; Using filesort
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
+a
+2
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
+a
+2
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
+a
+select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2)
+8 7.5000
+8 4.5000
+9 7.5000
+explain select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t4 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBSELECT t2 ALL NULL NULL NULL NULL 2
+3 DEPENDENT SUBSELECT t3 ALL NULL NULL NULL NULL 3 where used
+select * from t3 where exists (select * from t2 where t2.b=t3.a);
+a
+7
+select * from t3 where not exists (select * from t2 where t2.b=t3.a);
+a
+6
+3
+insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9);
+select b,max(a) as ma from t4 group by b having b < (select max(t2.a)
+from t2 where t2.b=t4.b);
+b ma
+select b,max(a) as ma from t4 group by b having b >= (select max(t2.a)
+from t2 where t2.b=t4.b);
+b ma
+7 12
+create table t5 (a int);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+insert into t5 values (5);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+insert into t5 values (2);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+(select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) a
+NULL 1
+2 2
+explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2
+2 DEPENDENT SUBSELECT t1 system NULL NULL NULL NULL 1 where used
+3 DEPENDENT UNION t5 ALL NULL NULL NULL NULL 2 where used
+select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
+Subselect returns more than 1 record
+create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq));
+create table clinic( uq int primary key, name char(25));
+insert into clinic values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
+insert into attend values (1,1),(1,2),(2,2),(1,3);
+select * from attend where exists (select * from clinic where uq = clinic_uq);
+patient_uq clinic_uq
+1 1
+1 2
+2 2
+select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
+Column: 'a' in field list is ambiguous
+drop table if exists t1,t2,t3;
+CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
+INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
+CREATE TABLE t2 (a varchar(20),b int NOT NULL default '0');
+INSERT INTO t2 VALUES ('W','1'),('A','3'),('J','2');
+CREATE TABLE t1 (a varchar(20),b date NOT NULL default '0000-00-00');
+INSERT INTO t1 VALUES ('W','1732-02-22'),('A','1735-10-30'),('J','1743-04-13');
+SELECT * FROM t1 WHERE b = (SELECT MIN(b) FROM t1);
+a b
+W 1732-02-22
+SELECT * FROM t2 WHERE b = (SELECT MIN(b) FROM t2);
+a b
+W 1
+SELECT * FROM t3 WHERE b = (SELECT MIN(b) FROM t3);
+a b
+W a
+drop table if exists inscrit;
+CREATE TABLE `inscrit` (
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+`email` varchar(60) character set latin1 NOT NULL default '',
+PRIMARY KEY (`pseudo`),
+UNIQUE KEY `email` (`email`)
+) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
+INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
+INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY inscrit const PRIMARY PRIMARY 35 const 1
+4 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
+2 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
+3 SUBSELECT inscrit const PRIMARY PRIMARY 35 const 1
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo,email FROM
+inscrit WHERE pseudo='joce');
+Subselect returns more than 1 field
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT * FROM inscrit WHERE
+pseudo='joce');
+Subselect returns more than 1 field
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
+pseudo
+joce
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
+Subselect returns more than 1 record
+drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
+drop table if exists searchconthardwarefr3;
+CREATE TABLE `searchconthardwarefr3` (
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) character set latin1 NOT NULL default '',
+PRIMARY KEY (`pseudo`,`date`,`topic`),
+KEY `topic` (`topic`)
+) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
+('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
+EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index
+EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY No tables used
+2 SUBSELECT searchconthardwarefr3 index NULL PRIMARY 41 NULL 2 where used; Using index
+SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
+date
+2002-08-03
+SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
+(SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03')
+2002-08-03
+SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
+1
+1
+1
+1
+SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
+Subselect returns more than 1 record
+EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY searchconthardwarefr3 index NULL topic 3 NULL 2 Using index
+2 SUBSELECT No tables used
+3 UNION No tables used
+drop table searchconthardwarefr3;
+drop table if exists forumconthardwarefr7, searchconthardwarefr7;
+CREATE TABLE `forumconthardwarefr7` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) TYPE=MyISAM ROW_FORMAT=FIXED;
+INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
+CREATE TABLE `searchconthardwarefr7` (
+`mot` varchar(30) NOT NULL default '',
+`topic` mediumint(8) unsigned NOT NULL default '0',
+`date` date NOT NULL default '0000-00-00',
+`pseudo` varchar(35) NOT NULL default '',
+PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`)
+) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO searchconthardwarefr7 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
+select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+a
+40143
+SELECT numeropost,maxnumrep FROM forumconthardwarefr7 WHERE exists (SELECT 1 FROM searchconthardwarefr7 WHERE (mot='joce') AND date >= '2002-10-21' AND forumconthardwarefr7.numeropost = searchconthardwarefr7.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
+numeropost maxnumrep
+43506 2
+40143 1
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+Unknown column 'a' in 'having clause'
+drop table forumconthardwarefr7, searchconthardwarefr7;
+drop table if exists forumconthardwarefr7;
+CREATE TABLE `forumconthardwarefr7` (
+`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+`maxnumrep` int(10) unsigned NOT NULL default '0',
+PRIMARY KEY (`numeropost`),
+UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) TYPE=MyISAM ROW_FORMAT=FIXED;
+INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (1,0),(2,1);
+select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+Subselect returns more than 1 record
+select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+Subselect returns more than 1 record
+drop table if exists forumconthardwarefr7;
+drop table if exists iftest;
+CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
+INSERT INTO iftest VALUES ();
+SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
+Subselect returns more than 1 record
+drop table iftest;
+drop table if exists threadhardwarefr7;
+CREATE TABLE `threadhardwarefr7` (
+`numeropost` mediumint(8) unsigned NOT NULL default '0',
+`numreponse` int(10) unsigned NOT NULL auto_increment,
+`pseudo` varchar(35) NOT NULL default '',
+PRIMARY KEY (`numeropost`,`numreponse`),
+UNIQUE KEY `numreponse` (`numreponse`),
+KEY `pseudo` (`pseudo`,`numeropost`)
+) TYPE=MyISAM;
+INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
+Subselect returns more than 1 record
+EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE Select tables optimized away
+EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1');
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY threadhardwarefr7 const PRIMARY,numreponse PRIMARY 7 const,const 1
+2 SUBSELECT Select tables optimized away
+drop table if exists threadhardwarefrtest7;
diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result
index 5626bc0fe11..1eb595eb2a9 100644
--- a/mysql-test/r/symlink.result
+++ b/mysql-test/r/symlink.result
@@ -36,10 +36,10 @@ show create table t9;
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment,
- `b` char(16) NOT NULL default '',
+ `b` char(16) character set latin1 NOT NULL default '',
`c` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
@@ -57,9 +57,9 @@ show create table test_mysqltest.t9;
Table Create Table
t9 CREATE TABLE `t9` (
`a` int(11) NOT NULL auto_increment,
- `b` char(16) NOT NULL default '',
+ `b` char(16) character set latin1 NOT NULL default '',
`c` int(11) NOT NULL default '0',
`d` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
-) TYPE=MyISAM
+) TYPE=MyISAM CHARSET=latin1
drop database test_mysqltest;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 2047eed6227..ba8d4f770f6 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -1,4 +1,36 @@
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
+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
+create table t3 (a long, b long byte);
+show create TABLE t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` mediumtext character set latin1,
+ `b` mediumblob
+) TYPE=MyISAM CHARSET=latin1
+drop table t1,t2,t3
+#;
+CREATE TABLE t1 (a char(257) default "hello");
+Too big column length for column 'a' (max = 255). Use BLOB instead
+CREATE TABLE t2 (a blob default "hello");
+BLOB column 'a' can't have a default value
+drop table if exists t1,t2;
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
insert into t1 values (null,"a","A");
insert into t1 values (null,"bbb","BBB");
@@ -37,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
-t text YES NULL select,insert,update,references
-c varchar(10) 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 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
lock tables t1 WRITE;
show full fields from t1;
-Field Type Null Key Default Extra Privileges
-t text YES NULL select,insert,update,references
-c varchar(10) 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 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
unlock tables;
select t from t1 where t like "hello";
t
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 38b264b96b9..1e58b8da42e 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -75,6 +75,6 @@ date numfacture expedition
0000-00-00 00:00:00 0 0001-00-00 00:00:00
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
-table type possible_keys key key_len ref rows Extra
-t1 ref expedition expedition 8 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref expedition expedition 8 const 1 Using where
drop table t1;
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index ee3bd077798..51e11d259eb 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') NOT NULL default ''
-) TYPE=MyISAM
+ `a` enum('','a','b') character set latin1 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') NOT NULL default 'b'
-) TYPE=MyISAM
+ `a` enum('','a','b') character set latin1 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 e85bced353a..c6eca3abe8b 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -10,9 +10,9 @@ 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;
-Field Type Null Key Default Extra Privileges
-f1 float YES NULL select,insert,update,references
-f2 double YES NULL select,insert,update,references
+Field Type Null Key Default Extra Privileges Comment
+f1 float YES NULL select,insert,update,references
+f2 double 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
-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 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
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 fc7cc5255cf..d0f964e4641 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
-auto int(5) unsigned PRI NULL auto_increment select,insert,update,references
-string varchar(10) 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(14) 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') MUL one select,insert,update,references
-flags set('one','two','tree') select,insert,update,references
+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(14) 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
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
-auto int(5) unsigned MUL NULL auto_increment select,insert,update,references
-string varchar(10) 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(14) YES NULL select,insert,update,references
-date_field varchar(10) 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) 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') MUL one select,insert,update,references
-flags set('one','two','tree') select,insert,update,references
-new_field varchar(10) new select,insert,update,references
+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(14) 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
show full columns from t2;
-Field Type Null Key Default Extra Privileges
-auto int(5) unsigned 0 select,insert,update,references
-string varchar(10) 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(14) YES NULL select,insert,update,references
-date_field varchar(10) 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) 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') one select,insert,update,references
-flags set('one','two','tree') select,insert,update,references
-new_field varchar(10) new select,insert,update,references
+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(14) 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
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
-auto bigint(17) unsigned PRI 0 select,insert,update,references
-t1 bigint(1) 0 select,insert,update,references
-t2 char(1) select,insert,update,references
-t3 mediumtext select,insert,update,references
-t4 mediumblob select,insert,update,references
+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
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
-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 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
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 59f8744e2ec..256937c586a 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') NOT NULL default ''
-) TYPE=MyISAM
+ `a` set('','a','b') character set latin1 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') NOT NULL default 'b'
-) TYPE=MyISAM
+ `a` set('','a','b') character set latin1 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 896901dd8af..0745f082993 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -85,36 +85,31 @@ a b
2 b
1 a
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
-t2 ALL NULL NULL NULL NULL 4 Using filesort
-t1 ALL NULL NULL NULL NULL 4
-(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
-a b
-1 a
-2 b
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort
select found_rows();
FOUND_ROWS()
-6
+0
explain select a,b from t1 union all select a,b from t2;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
-t2 ALL NULL NULL NULL NULL 4
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 UNION t2 ALL NULL NULL NULL NULL 4
explain select xx from t1 union select 1;
Unknown column 'xx' in 'field list'
explain select a,b from t1 union select 1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
- 0 0 No tables used
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 4
+2 UNION No tables used
explain select 1 union select a,b from t1 union select 1;
-table type possible_keys key key_len ref rows Extra
- 0 0 No tables used
-t1 ALL NULL NULL NULL NULL 4
- 0 0 No tables used
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY No tables used
+2 UNION t1 ALL NULL NULL NULL NULL 4
+3 UNION No tables used
explain select a,b from t1 union select 1 limit 0;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 4
- 0 0 Impossible WHERE
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY Impossible WHERE
+2 UNION Impossible WHERE
select a,b from t1 into outfile 'skr' union select a,b from t2;
Wrong usage of UNION and INTO
select a,b from t1 order by a union select a,b from t2;
@@ -202,3 +197,5 @@ a
11
set SQL_SELECT_LIMIT=DEFAULT;
drop table t1,t2;
+select * union select 1;
+No tables used
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 5e9f3a720c2..1b0b359c533 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -18,15 +18,15 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3
1 1 0 1 2
2 1 0 0 1
explain select * from t1 where i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 ref i i 4 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 1 Using where
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 3 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
explain select @vv1:=i from t1 where i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 index NULL i 4 NULL 3 Using where; Using index
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL i 4 NULL 3 Using where; Using index
explain select * from t1 where i=@vv1;
-table type possible_keys key key_len ref rows Extra
-t1 ref i i 4 const 1 Using where
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 1 Using where
drop table t1,t2;
diff --git a/mysql-test/r/varbinary.result b/mysql-test/r/varbinary.result
index 4eb34ebfd63..7ce0f78da76 100644
--- a/mysql-test/r/varbinary.result
+++ b/mysql-test/r/varbinary.result
@@ -12,8 +12,8 @@ create table t1 (ID int(8) unsigned zerofill not null auto_increment,UNIQ bigint
insert into t1 set UNIQ=0x38afba1d73e6a18a;
insert into t1 set UNIQ=123;
explain select * from t1 where UNIQ=0x38afba1d73e6a18a;
-table type possible_keys key key_len ref rows Extra
-t1 const UNIQ UNIQ 8 const 1
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const UNIQ UNIQ 8 const 1
drop table t1;
select x'hello';
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'x'hello'' at line 1
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index f8ac13477a9..fbbf7fcb8f4 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -48,9 +48,6 @@ 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 4294967295
set GLOBAL max_join_size=2000;
show global variables like 'max_join_size';
Variable_name Value
@@ -62,7 +59,7 @@ max_join_size 2000
set GLOBAL max_join_size=DEFAULT;
show global variables like 'max_join_size';
Variable_name Value
-max_join_size 4294967295
+max_join_size 18446744073709551615
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
diff --git a/mysql-test/std_data/master-bin.001 b/mysql-test/std_data/master-bin.000001
index 2ec2397acdd..2ec2397acdd 100644
--- a/mysql-test/std_data/master-bin.001
+++ b/mysql-test/std_data/master-bin.000001
Binary files differ
diff --git a/mysql-test/t/README b/mysql-test/t/README
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/mysql-test/t/README
+++ /dev/null
diff --git a/mysql-test/t/bdb-deadlock.test b/mysql-test/t/bdb-deadlock.test
index b32b50c715b..5ecfe592ce4 100644
--- a/mysql-test/t/bdb-deadlock.test
+++ b/mysql-test/t/bdb-deadlock.test
@@ -30,13 +30,19 @@ select x from t1 where id = 0;
connection con1;
# This should generate a deadlock as we are trying to access a locked row
---error 1213
+--send
select x from t2 where id = 0;
-commit;
connection con2;
+--error 1213
reap;
commit;
+
+connection con1;
+reap;
+commit;
+
+connection con2;
select * from t1;
select * from t2;
commit;
@@ -45,4 +51,5 @@ connection con1;
select * from t1;
select * from t2;
commit;
+
drop table t1,t2;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index bb0d6dc0d64..3bad053875c 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -22,12 +22,12 @@ drop table if exists t1;
!$1146 create table t2 select auto+1 from t1;
drop table if exists t1,t2;
!$1167 create table t1 (b char(0) not null, index(b));
-!$1164 create table t1 (a int not null auto_increment,primary key (a)) type=heap;
+create table t1 (a int not null auto_increment,primary key (a)) type=heap;
!$1163 create table t1 (a int not null,b text) type=heap;
!$1171 create table t1 (a int ,primary key(a)) type=heap;
drop table if exists t1;
-!$1164 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
+!$1075 create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null, primary key (ord,ordid)) type=heap;
!$1171 create table t1 (ordid int(8), primary key (ordid));
-- error 1044,1
@@ -83,6 +83,22 @@ describe t2;
drop table t1,t2;
#
+# Test of CREATE ... SELECT with duplicate fields
+#
+
+create table t1 (a tinyint);
+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;
+drop table if exists t2;
+!$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;
+drop table if exists t1,t2;
+
+#
# Test of primary key with 32 index
#
@@ -94,3 +110,6 @@ drop table t1;
create table t1 select if('2002'='2002','Y','N');
select * from t1;
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;
diff --git a/mysql-test/t/ctype_many.test b/mysql-test/t/ctype_many.test
new file mode 100644
index 00000000000..1e89b1419d2
--- /dev/null
+++ b/mysql-test/t/ctype_many.test
@@ -0,0 +1,191 @@
+DROP TABLE IF EXISTS t1;
+
+CREATE TABLE t1 (
+ comment CHAR(32) CHARACTER SET latin1 NOT NULL,
+ koi8_ru_f CHAR(32) CHARACTER SET koi8_ru NOT NULL
+) CHARSET=latin5;
+
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 CHARSET=latin2;
+ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('c','LAT SMALL C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('d','LAT SMALL D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('e','LAT SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('f','LAT SMALL F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('g','LAT SMALL G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('h','LAT SMALL H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('i','LAT SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('j','LAT SMALL J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('k','LAT SMALL K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('l','LAT SMALL L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('m','LAT SMALL M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('n','LAT SMALL N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('o','LAT SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('p','LAT SMALL P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('q','LAT SMALL Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('r','LAT SMALL R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('s','LAT SMALL S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('t','LAT SMALL T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('u','LAT SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('v','LAT SMALL V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('w','LAT SMALL W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('x','LAT SMALL X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('y','LAT SMALL Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('z','LAT SMALL Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('A','LAT CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('B','LAT CAPIT B');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('C','LAT CAPIT C');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('D','LAT CAPIT D');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('E','LAT CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('F','LAT CAPIT F');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('G','LAT CAPIT G');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('H','LAT CAPIT H');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('I','LAT CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('J','LAT CAPIT J');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('K','LAT CAPIT K');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('L','LAT CAPIT L');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('M','LAT CAPIT M');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('N','LAT CAPIT N');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('O','LAT CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('P','LAT CAPIT P');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Q','LAT CAPIT Q');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('R','LAT CAPIT R');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('S','LAT CAPIT S');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('T','LAT CAPIT T');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('U','LAT CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('V','LAT CAPIT V');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('W','LAT CAPIT W');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('X','LAT CAPIT X');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Y','LAT CAPIT Y');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Z','LAT CAPIT Z');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Á','CYR SMALL A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Â','CYR SMALL BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('×','CYR SMALL VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ç','CYR SMALL GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ä','CYR SMALL DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Å','CYR SMALL IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('£','CYR SMALL IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ö','CYR SMALL ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ú','CYR SMALL ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('É','CYR SMALL I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ë','CYR SMALL KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ì','CYR SMALL EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Í','CYR SMALL EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Î','CYR SMALL EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ï','CYR SMALL O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ð','CYR SMALL PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ò','CYR SMALL ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ó','CYR SMALL ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ô','CYR SMALL TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Õ','CYR SMALL U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Æ','CYR SMALL EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('È','CYR SMALL HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ã','CYR SMALL TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Þ','CYR SMALL CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Û','CYR SMALL SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ý','CYR SMALL SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ß','CYR SMALL HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ù','CYR SMALL YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ø','CYR SMALL SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ü','CYR SMALL E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('À','CYR SMALL YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('Ñ','CYR SMALL YA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('á','CYR CAPIT A');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('â','CYR CAPIT BE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('÷','CYR CAPIT VE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ç','CYR CAPIT GE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ä','CYR CAPIT DE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('å','CYR CAPIT IE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('³','CYR CAPIT IO');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ö','CYR CAPIT ZHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ú','CYR CAPIT ZE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('é','CYR CAPIT I');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ë','CYR CAPIT KA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ì','CYR CAPIT EL');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('í','CYR CAPIT EM');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('î','CYR CAPIT EN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ï','CYR CAPIT O');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ð','CYR CAPIT PE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ò','CYR CAPIT ER');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ó','CYR CAPIT ES');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ô','CYR CAPIT TE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('õ','CYR CAPIT U');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('æ','CYR CAPIT EF');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('è','CYR CAPIT HA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ã','CYR CAPIT TSE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('þ','CYR CAPIT CHE');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('û','CYR CAPIT SHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ý','CYR CAPIT SCHA');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ÿ','CYR CAPIT HARD SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ù','CYR CAPIT YERU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ø','CYR CAPIT SOFT SIGN');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ü','CYR CAPIT E');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('à','CYR CAPIT YU');
+INSERT INTO t1 (koi8_ru_f,comment) VALUES ('ñ','CYR CAPIT YA');
+
+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;
+
+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;
+SELECT DISTINCT utf8_f FROM t1;
+SELECT lower(koi8_ru_f) FROM t1 ORDER BY 1 DESC;
+SELECT lower(utf8_f) FROM t1 ORDER BY 1 DESC;
+
+SELECT t11.comment,t12.comment
+FROM t1 t11,t1 t12 WHERE CONVERT(t11.koi8_ru_f USING utf8)=t12.utf8_f
+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)
+ORDER BY t12.utf8_f,t11.comment,t12.comment;
+
+ALTER TABLE t1 ADD ucs2_f CHAR(32) CHARACTER SET ucs2 NOT NULL;
+
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0391,'GREEK CAPIT ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0392,'GREEK CAPIT BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0393,'GREEK CAPIT GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0394,'GREEK CAPIT DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0395,'GREEK CAPIT EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B1,'GREEK SMALL ALPHA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B2,'GREEK SMALL BETA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B3,'GREEK SMALL GAMMA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B4,'GREEK SMALL DELTA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x03B5,'GREEK SMALL EPSILON');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0531,'ARMENIAN CAPIT AYB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0532,'ARMENIAN CAPIT BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0533,'ARMENIAN CAPIT GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0534,'ARMENIAN CAPIT DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0535,'ARMENIAN CAPIT ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0536,'ARMENIAN CAPIT ZA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0561,'ARMENIAN SMALL YAB');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0562,'ARMENIAN SMALL BEN');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0563,'ARMENIAN SMALL GIM');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0564,'ARMENIAN SMALL DA');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0565,'ARMENIAN SMALL ECH');
+INSERT INTO t1 (ucs2_f,comment) VALUES (0x0566,'ARMENIAN SMALL ZA');
+
+ALTER TABLE t1 ADD armscii8_f CHAR(32) CHARACTER SET armscii8 NOT NULL;
+ALTER TABLE t1 ADD greek_f CHAR(32) CHARACTER SET greek NOT NULL;
+UPDATE t1 SET greek_f=CONVERT(ucs2_f USING greek) WHERE comment LIKE 'GRE%';
+UPDATE t1 SET armscii8_f=CONVERT(ucs2_f USING armscii8) WHERE comment LIKE 'ARM%';
+UPDATE t1 SET utf8_f=CONVERT(ucs2_f USING utf8) WHERE utf8_f='';
+UPDATE t1 SET ucs2_f=CONVERT(utf8_f USING ucs2) WHERE ucs2_f='';
+SELECT min(comment),count(*) FROM t1 GROUP BY ucs2_f;
+DROP TABLE t1;
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
new file mode 100644
index 00000000000..de765a0e280
--- /dev/null
+++ b/mysql-test/t/derived.test
@@ -0,0 +1,36 @@
+drop table if exists t1,t2,t3;
+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);
+insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
+select t1.a,t3.y from t1,(select a as y from t2 where b='c') as t3 where t1.a = t3.y;
+select t1.a,t3.a from t1,(select * from t2 where b='c') as t3 where t1.a = t3.a;
+CREATE TABLE t3 (a int not null, b char (10) not null);
+insert into t3 values (3,'f'),(4,'y'),(5,'z'),(6,'c');
+select t1.a,t4.y from t1,(select t2.a as y from t2,(select t3.b from t3 where t3.a>3) as t5 where t2.b=t5.b) as t4 where t1.a = t4.y;
+--error 1054
+SELECT a FROM (SELECT 1 FROM (SELECT 1) HAVING a=1);
+--error 1052
+SELECT a,b as a FROM (SELECT '1' as a,'2' as b) HAVING a=1;
+SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=2;
+SELECT a,2 as a FROM (SELECT '1' as a) HAVING a=1;
+--error 1054
+SELECT 1 FROM (SELECT 1) WHERE a=2;
+--error 1054
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM t1 HAVING a=1);
+drop table if exists t1.t2,t3;
+select * from (select 1);
+select a from (select 1 as a);
+select 1 from (select 1);
+drop table if exists t1;
+create table t1(a int not null, t char(8), index(a));
+disable_query_log;
+let $1 = 10000;
+while ($1)
+ {
+ eval insert into t1 values ($1,'$1');
+ dec $1;
+ }
+enable_query_log;
+SELECT * FROM (SELECT * FROM t1) ORDER BY a ASC LIMIT 0,20;
+drop table if exists t1; \ No newline at end of file
diff --git a/mysql-test/t/func_system.test b/mysql-test/t/func_system.test
index 052e0530cf6..c69526644f4 100644
--- a/mysql-test/t/func_system.test
+++ b/mysql-test/t/func_system.test
@@ -4,3 +4,4 @@
select database(),user() like "%@%";
select version()>="3.23.29";
+select TRUE,FALSE,NULL;
diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test
index f5ad2e21c73..8810aefc20f 100644
--- a/mysql-test/t/func_test.test
+++ b/mysql-test/t/func_test.test
@@ -17,6 +17,7 @@ select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,
select -1.49 or -1.49,0.6 or 0.6;
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
+select 10 % 7, 10 mod 7, 10 div 3;
#
# Wrong usage of functions
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index ef7e3239a96..f8b27d09a19 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -42,7 +42,7 @@ alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
drop table t1;
-create table t1 (x int not null, y int not null, key x(x), unique y(y))
+create table t1 (x int not null, y int not null, key x (x), unique y (y))
type=heap;
insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
select * from t1 where x=1;
diff --git a/mysql-test/t/heap_auto_increment.test b/mysql-test/t/heap_auto_increment.test
new file mode 100644
index 00000000000..8a0d19d9183
--- /dev/null
+++ b/mysql-test/t/heap_auto_increment.test
@@ -0,0 +1,30 @@
+#
+# Test of auto_increment; The test for BDB tables is in bdb.test
+#
+
+drop table if exists t1;
+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;
+insert into t1 values (NULL,5),(NULL,6);
+select * from t1;
+delete from t1 where a=6;
+#show table status like "t1";
+replace t1 values (3,1);
+ALTER TABLE t1 add c int;
+replace t1 values (3,3,3);
+insert into t1 values (NULL,7,7);
+update t1 set a=8,b=b+1,c=c+1 where a=7;
+insert into t1 values (NULL,9,9);
+select * from t1;
+drop table t1;
+
+create table t1 (
+ skey tinyint unsigned NOT NULL auto_increment PRIMARY KEY,
+ sval char(20)
+) type=heap;
+insert into t1 values (NULL, "hello");
+insert into t1 values (NULL, "hey");
+select * from t1;
+select _rowid,t1._rowid,skey,sval from t1;
+drop table t1;
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
new file mode 100644
index 00000000000..5c0002fede4
--- /dev/null
+++ b/mysql-test/t/heap_btree.test
@@ -0,0 +1,155 @@
+#
+# Test of heap tables.
+#
+
+drop table if exists t1;
+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;
+#show table status like "t1";
+show keys from t1;
+select * from t1;
+select * from t1 where a=4;
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+alter table t1 add c int not null, add key using BTREE (c,a);
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > 0;
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using BTREE (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+#show table status like "t1";
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null) type=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+alter table t1 add unique uniq_id using BTREE (a);
+select * from t1 where a > 736494;
+select * from t1 where a = 736494;
+select * from t1 where a=869751 or a=736494;
+select * from t1 where a in (869751,736494,226312,802616);
+alter table t1 type=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+drop table t1;
+
+create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y))
+type=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+explain select * from t1 where x=1;
+select * from t1 where x=1;
+select * from t1,t1 as t2 where t1.x=t2.y;
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+drop table t1;
+
+create table t1 (a int) type=heap;
+insert into t1 values(1);
+select max(a) from t1;
+drop table t1;
+
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using BTREE (a,b), key using BTREE (b) ) TYPE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+--replace_result 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x
+explain select * from t1 where a=1 order by a,b;
+--replace_result 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x
+explain select * from t1 where a=1 order by b;
+select * from t1 where b=1;
+--replace_result 0 x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x 10 x 11 x 12 x 13 x 14 x
+explain select * from t1 where b=1;
+drop table t1;
+
+create table t1 (id int unsigned not null, primary key using BTREE (id)) type=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+insert into t1 values(2);
+select max(id) from t1;
+replace into t1 values(1);
+drop table t1;
+
+create table t1 (n int) type=heap;
+drop table t1;
+
+create table t1 (n int) type=heap;
+drop table if exists t1;
+
+# Test of non unique index
+
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) type=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+drop table t1;
+
+#
+# Test when using part key searches
+#
+
+create table t1 (btn char(10) not null, key using BTREE (btn)) type=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "q%";
+select * from t1 where btn like "q%";
+alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn;
+update t1 set new_col=btn;
+explain select * from t1 where btn="a";
+explain select * from t1 where btn="a" and new_col="a";
+drop table t1;
+
+#
+# Test of NULL keys
+#
+
+CREATE TABLE t1 (
+ a int default NULL,
+ b int default NULL,
+ KEY a using BTREE (a),
+ UNIQUE b using BTREE (b)
+) type=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+explain SELECT * FROM t1 WHERE a IS NULL;
+SELECT * FROM t1 WHERE a<=>NULL;
+SELECT * FROM t1 WHERE b=NULL;
+explain SELECT * FROM t1 WHERE b IS NULL;
+SELECT * FROM t1 WHERE b<=>NULL;
+
+--error 1062
+INSERT INTO t1 VALUES (1,3);
+DROP TABLE t1;
+
+CREATE TABLE t1 (a int, b int, c int, key using BTREE (a, b, c)) type=heap;
+INSERT INTO t1 VALUES (1, NULL, NULL), (1, 1, NULL), (1, NULL, 1);
+SELECT * FROM t1 WHERE a=1 and b IS NULL;
+SELECT * FROM t1 WHERE a=1 and c IS NULL;
+SELECT * FROM t1 WHERE a=1 and b IS NULL and c IS NULL;
+DROP TABLE t1;
+
+#
+# Test when deleting all rows
+#
+
+CREATE TABLE t1 (a int not null, primary key using BTREE (a)) type=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test
new file mode 100644
index 00000000000..5dbd2b4a928
--- /dev/null
+++ b/mysql-test/t/heap_hash.test
@@ -0,0 +1,140 @@
+#
+# Test of heap tables.
+#
+
+drop table if exists t1;
+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;
+#show table status like "t1";
+show keys from t1;
+select * from t1;
+select * from t1 where a=4;
+update t1 set b=5 where a=4;
+update t1 set b=b+1 where a>=3;
+replace t1 values (3,3);
+select * from t1;
+alter table t1 add c int not null, add key using HASH (c,a);
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+delete from t1 where a > 0;
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null,b int not null, primary key using HASH (a)) type=heap comment="testing heaps";
+insert into t1 values(1,1),(2,2),(3,3),(4,4);
+alter table t1 modify a int not null auto_increment, type=myisam, comment="new myisam table";
+#show table status like "t1";
+select * from t1;
+drop table t1;
+
+create table t1 (a int not null) type=heap;
+insert into t1 values (869751),(736494),(226312),(802616);
+select * from t1 where a > 736494;
+alter table t1 add unique uniq_id using HASH (a);
+select * from t1 where a > 736494;
+select * from t1 where a = 736494;
+select * from t1 where a=869751 or a=736494;
+select * from t1 where a in (869751,736494,226312,802616);
+alter table t1 type=myisam;
+explain select * from t1 where a in (869751,736494,226312,802616);
+drop table t1;
+
+create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y))
+type=heap;
+insert into t1 values (1,1),(2,2),(1,3),(2,4),(2,5),(2,6);
+select * from t1 where x=1;
+select * from t1,t1 as t2 where t1.x=t2.y;
+explain select * from t1,t1 as t2 where t1.x=t2.y;
+drop table t1;
+
+create table t1 (a int) type=heap;
+insert into t1 values(1);
+select max(a) from t1;
+drop table t1;
+
+CREATE TABLE t1 ( a int not null default 0, b int not null default 0, key using HASH (a), key using HASH (b) ) TYPE=HEAP;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+insert into t1 values(1,1),(1,2),(2,3),(1,3),(1,4),(1,5),(1,6);
+select * from t1 where a=1;
+drop table t1;
+
+create table t1 (id int unsigned not null, primary key using HASH (id)) type=HEAP;
+insert into t1 values(1);
+select max(id) from t1;
+insert into t1 values(2);
+select max(id) from t1;
+replace into t1 values(1);
+drop table t1;
+
+create table t1 (n int) type=heap;
+drop table t1;
+
+create table t1 (n int) type=heap;
+drop table if exists t1;
+
+# Test of non unique index
+
+CREATE table t1(f1 int not null,f2 char(20) not
+null,index(f2)) type=heap;
+INSERT into t1 set f1=12,f2="bill";
+INSERT into t1 set f1=13,f2="bill";
+INSERT into t1 set f1=14,f2="bill";
+INSERT into t1 set f1=15,f2="bill";
+INSERT into t1 set f1=16,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+INSERT into t1 set f1=12,f2="ted";
+delete from t1 where f2="bill";
+select * from t1;
+drop table t1;
+
+#
+# Test when using part key searches
+#
+
+create table t1 (btn char(10) not null, key using HASH (btn)) type=heap;
+insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
+explain select * from t1 where btn like "q%";
+select * from t1 where btn like "q%";
+alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn;
+update t1 set new_col=btn;
+explain select * from t1 where btn="a";
+explain select * from t1 where btn="a" and new_col="a";
+drop table t1;
+
+#
+# Test of NULL keys
+#
+
+CREATE TABLE t1 (
+ a int default NULL,
+ b int default NULL,
+ KEY a using HASH (a),
+ UNIQUE b using HASH (b)
+) type=heap;
+INSERT INTO t1 VALUES (NULL,99),(99,NULL),(1,1),(2,2),(1,3);
+SELECT * FROM t1 WHERE a=NULL;
+explain SELECT * FROM t1 WHERE a IS NULL;
+SELECT * FROM t1 WHERE a<=>NULL;
+SELECT * FROM t1 WHERE b=NULL;
+explain SELECT * FROM t1 WHERE b IS NULL;
+SELECT * FROM t1 WHERE b<=>NULL;
+
+--error 1062
+INSERT INTO t1 VALUES (1,3);
+DROP TABLE t1;
+
+#
+# Test when deleting all rows
+#
+
+CREATE TABLE t1 (a int not null, primary key using HASH (a)) type=heap;
+INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
+DELETE from t1 where a < 100;
+SELECT * from t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 1265d809149..9c261ebf5bb 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -5,7 +5,7 @@
drop table if exists t1;
CREATE TABLE t1 (
STRING_DATA char(255) default NULL,
- KEY STRING_DATA (STRING_DATA)
+ KEY string_data (STRING_DATA)
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
diff --git a/mysql-test/t/rollback.test b/mysql-test/t/rollback.test
index 6ea2cca887f..bd37e69ae23 100644
--- a/mysql-test/t/rollback.test
+++ b/mysql-test/t/rollback.test
@@ -8,7 +8,12 @@ create table t1 (n int not null primary key) type=myisam;
begin work;
insert into t1 values (4);
insert into t1 values (5);
-# Should give an error
-!$1196 rollback;
+rollback;
+select @@warning_count;
+select @@error_count;
+show warnings;
+show errors;
select * from t1;
+select @@warning_count;
+show warnings;
drop table t1;
diff --git a/mysql-test/t/rpl000001.test b/mysql-test/t/rpl000001.test
index 0f195c65fb0..ce6897e63e1 100644
--- a/mysql-test/t/rpl000001.test
+++ b/mysql-test/t/rpl000001.test
@@ -12,11 +12,11 @@ select * from t1;
save_master_pos;
connection slave;
sync_with_master;
-slave stop;
+stop slave;
connection master;
set password for root@"localhost" = password('foo');
connection slave;
-slave start;
+start slave;
connection master;
#
# Give slave time to do at last one failed connect retry
@@ -43,7 +43,7 @@ sync_with_master;
connection master;
reset master;
connection slave;
-slave stop;
+stop slave;
reset slave;
connection master;
@@ -62,7 +62,7 @@ enable_query_log;
# Try to cause a large relay log lag on the slave
connection slave;
select get_lock("hold_slave",10);
-slave start;
+start slave;
#hope this is long enough for I/O thread to fetch over 16K relay log data
sleep 3;
select release_lock("hold_slave");
@@ -100,7 +100,7 @@ wait_for_slave_to_stop;
# show slave status;
set global sql_slave_skip_counter=1;
-slave start;
+start slave;
select count(*) from t1;
connection master1;
drop table t1;
diff --git a/mysql-test/t/rpl000002.test b/mysql-test/t/rpl000002.test
index caf0b4ef6d8..5fabe0d2c59 100644
--- a/mysql-test/t/rpl000002.test
+++ b/mysql-test/t/rpl000002.test
@@ -3,18 +3,14 @@ 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);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
--replace_result $SLAVE_MYPORT 9999
show slave hosts;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
-slave stop;
+sync_slave_with_master;
+stop slave;
connection master;
drop table if exists t2;
create table t2(id int auto_increment primary key, created datetime);
@@ -23,11 +19,9 @@ insert into t2 set created=now();
select * from t2;
save_master_pos;
connection slave;
-slave start;
+start slave;
sync_with_master;
select * from t2;
connection master;
drop table t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000011.test b/mysql-test/t/rpl000011.test
index d75937e3f81..dc84741694c 100644
--- a/mysql-test/t/rpl000011.test
+++ b/mysql-test/t/rpl000011.test
@@ -2,20 +2,14 @@ source include/master-slave.inc;
drop table if exists t1;
create table t1 (n int);
insert into t1 values(1);
-save_master_pos;
-connection slave;
-sync_with_master;
-slave stop;
-slave start;
+sync_slave_with_master;
+stop slave;
+start slave;
connection master;
insert into t1 values(2);
-save_master_pos;
-connection slave;
#let slave catch up
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000015.test b/mysql-test/t/rpl000015.test
index c42e14699c5..37155d33f08 100644
--- a/mysql-test/t/rpl000015.test
+++ b/mysql-test/t/rpl000015.test
@@ -18,7 +18,7 @@ eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
-slave start;
+start slave;
sync_with_master;
--replace_result $MASTER_MYPORT MASTER_PORT
show slave status;
@@ -26,12 +26,8 @@ connection master;
drop table if exists t1;
create table t1 (n int);
insert into t1 values (10),(45),(90);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000017-slave.sh b/mysql-test/t/rpl000017-slave.sh
index 066b4880cc1..fa21fe7acc3 100755
--- a/mysql-test/t/rpl000017-slave.sh
+++ b/mysql-test/t/rpl000017-slave.sh
@@ -1,7 +1,7 @@
rm -f $MYSQL_TEST_DIR/var/log/*relay*
rm -f $MYSQL_TEST_DIR/var/slave-data/relay-log.info
cat > $MYSQL_TEST_DIR/var/slave-data/master.info <<EOF
-master-bin.001
+master-bin.000001
4
127.0.0.1
replicate
diff --git a/mysql-test/t/rpl000017.test b/mysql-test/t/rpl000017.test
index f346ca39ca0..3bff9b4cbd8 100644
--- a/mysql-test/t/rpl000017.test
+++ b/mysql-test/t/rpl000017.test
@@ -5,17 +5,13 @@ reset master;
grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaaaaaab';
grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab';
connection slave;
-slave start;
+start slave;
connection master;
drop table if exists t1;
create table t1(n int);
insert into t1 values(24);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl000018.test b/mysql-test/t/rpl000018.test
index 291b482b912..e992f7938eb 100644
--- a/mysql-test/t/rpl000018.test
+++ b/mysql-test/t/rpl000018.test
@@ -10,18 +10,14 @@ server_stop master;
server_start master;
connection slave;
reset slave;
-slave start;
+start slave;
connection master;
-show master logs;
+show binary logs;
drop table if exists t1;
create table t1(n int);
insert into t1 values (3351);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_failsafe.test b/mysql-test/t/rpl_failsafe.test
index 866efbce5bf..ae61b061153 100644
--- a/mysql-test/t/rpl_failsafe.test
+++ b/mysql-test/t/rpl_failsafe.test
@@ -7,18 +7,16 @@ show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
create table t1(n int);
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
connection slave_sec;
-slave start;
+start slave;
sync_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
connection slave_ter;
-slave start;
+start slave;
sync_with_master;
show variables like 'rpl_recovery_rank';
show status like 'Rpl_status';
diff --git a/mysql-test/t/rpl_flush_log_loop.test b/mysql-test/t/rpl_flush_log_loop.test
index c68fbb7111a..62bcf2c8b33 100644
--- a/mysql-test/t/rpl_flush_log_loop.test
+++ b/mysql-test/t/rpl_flush_log_loop.test
@@ -7,13 +7,13 @@ connection slave;
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$MASTER_MYPORT;
-slave start;
+start slave;
connection master;
-slave stop;
+stop slave;
--replace_result $SLAVE_MYPORT SLAVE_PORT
eval change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=$SLAVE_MYPORT;
-slave start;
+start slave;
flush logs;
sleep 5;
--replace_result $SLAVE_MYPORT SLAVE_PORT
diff --git a/mysql-test/t/rpl_log.test b/mysql-test/t/rpl_log.test
index 85782e78142..dff57a77a45 100644
--- a/mysql-test/t/rpl_log.test
+++ b/mysql-test/t/rpl_log.test
@@ -2,7 +2,7 @@ source include/master-slave.inc;
#clean up slave binlogs
connection slave;
-slave stop;
+stop slave;
reset master;
reset slave;
let $VERSION=`select version()`;
@@ -26,10 +26,10 @@ flush logs;
save_master_pos;
connection slave;
-slave start;
+start slave;
sync_with_master;
flush logs;
-slave stop;
+stop slave;
connection master;
# Create some entries for second log
@@ -39,27 +39,27 @@ insert into t1 values (1);
drop table t1;
--replace_result $VERSION VERSION
show binlog events;
-show binlog events in 'master-bin.002';
-show master logs;
+show binlog events in 'master-bin.000002';
+show binary logs;
save_master_pos;
connection slave;
-slave start;
+start slave;
sync_with_master;
-show master logs;
+show binary logs;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
-show binlog events in 'slave-bin.001' from 4;
+show binlog events in 'slave-bin.000001' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT $VERSION VERSION
-show binlog events in 'slave-bin.002' from 4;
+show binlog events in 'slave-bin.000002' from 4;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
# Need to recode the following
-#show new master for slave with master_log_file='master-bin.001' and master_log_pos=4 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.001' and master_log_pos=79 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.001' and master_log_pos=311 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.002' and master_log_pos=4 and master_server_id=1;
-#show new master for slave with master_log_file='master-bin.002' and master_log_pos=122 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=79 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000001' and master_log_pos=311 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=4 and master_server_id=1;
+#show new master for slave with master_log_file='master-bin.000002' and master_log_pos=122 and master_server_id=1;
--error 1220
-show binlog events in 'slave-bin.005' from 4;
+show binlog events in 'slave-bin.000005' from 4;
diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test
index f585fa233c5..d320796edd3 100644
--- a/mysql-test/t/rpl_log_pos.test
+++ b/mysql-test/t/rpl_log_pos.test
@@ -3,26 +3,25 @@
#
source include/master-slave.inc;
show master status;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
change master to master_log_pos=73;
sleep 5;
-slave stop;
+stop slave;
change master to master_log_pos=73;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
-slave start;
+start slave;
sleep 5;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
change master to master_log_pos=173;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
-slave start;
+start slave;
sleep 2;
+--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
connection master;
show master status;
@@ -33,11 +32,9 @@ insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
change master to master_log_pos=79;
-slave start;
+start slave;
sync_with_master;
select * from t1;
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
index 5280cb360dd..d49f1a210f4 100644
--- a/mysql-test/t/rpl_mystery22.test
+++ b/mysql-test/t/rpl_mystery22.test
@@ -4,9 +4,7 @@ source include/master-slave.inc;
# first, cause a duplicate key problem on the slave
create table t1(n int auto_increment primary key);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
insert into t1 values (2);
connection master;
insert into t1 values(NULL);
@@ -16,11 +14,11 @@ connection slave;
sleep 3; # there is no way around this sleep - we have to wait until
# the slave tries to run the query, fails and aborts slave thread
delete from t1 where n = 2;
-slave start;
+start slave;
sync_with_master;
#now the buggy slave would be confused on the offset but it can replicate
#in order to make it break, we need to stop/start the slave one more time
-slave stop;
+stop slave;
connection master;
# to be able to really confuse the slave, we need some non-auto-increment
# events in the log
@@ -29,7 +27,7 @@ drop table t2;
insert into t1 values(NULL);
save_master_pos;
connection slave;
-slave start;
+start slave;
#now the truth comes out - if the slave is buggy, it will never sync because
#the slave thread is not able to read events
sync_with_master;
@@ -37,7 +35,5 @@ select * from t1;
#clean up
connection master;
drop table t1;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test
index a9bb98932ed..c552936d93f 100644
--- a/mysql-test/t/rpl_rotate_logs.test
+++ b/mysql-test/t/rpl_rotate_logs.test
@@ -17,10 +17,10 @@ system chmod 000 var/slave-data/master.info;
connection slave;
drop table if exists t1, t2, t3, t4;
--error 1201
-slave start;
+start slave;
system chmod 600 var/slave-data/master.info;
--error 1201
-slave start;
+start slave;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
# Will get error 13 on Unix systems becasue file is not readable
!eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
@@ -30,7 +30,7 @@ eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master
connection master;
reset master;
connection slave;
-slave start;
+start slave;
connection master;
#
@@ -40,9 +40,7 @@ create temporary table temp_table (a char(80) not null);
insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
select * from t1;
@@ -52,12 +50,10 @@ 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;
-show master logs;
+show binary logs;
create table t3 select * from temp_table;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t3;
connection master;
@@ -83,21 +79,17 @@ wait_for_slave_to_stop;
#restart slave skipping one event
set global sql_slave_skip_counter=1;
-slave start;
+start slave;
connection master;
-save_master_pos;
#let slave catch up
-connection slave;
-sync_with_master;
+sync_slave_with_master;
connection master;
-purge master logs to 'master-bin.003';
-show master logs;
+purge master logs to 'master-bin.000003';
+show binary logs;
insert into t2 values (65);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
--replace_result 3306 MASTER_PORT 9306 MASTER_PORT 3334 MASTER_PORT 3336 MASTER_PORT
show slave status;
select * from t2;
@@ -121,12 +113,12 @@ while ($1)
}
enable_query_log;
create table t4 select * from temp_table;
-show master logs;
+show binary logs;
show master status;
save_master_pos;
connection slave;
-#slave stop;
-#slave start;
+#stop slave;
+#start slave;
sync_with_master;
select * from t4;
@@ -140,6 +132,4 @@ unlock tables;
#clean up
connection master;
drop table if exists t1,t2,t3,t4;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test
index e59b93b4475..b24901c62a9 100644
--- a/mysql-test/t/rpl_sporadic_master.test
+++ b/mysql-test/t/rpl_sporadic_master.test
@@ -9,22 +9,16 @@ insert into t1 values (NULL),(NULL);
truncate table t1;
# We have to use 4 in the following to make this test work with all table types
insert into t1 values (4),(NULL);
-save_master_pos;
-connection slave;
-sync_with_master;
-slave stop;
-slave start;
+sync_slave_with_master;
+stop slave;
+start slave;
connection master;
insert into t1 values (NULL),(NULL);
flush logs;
truncate table t1;
insert into t1 values (10),(NULL),(NULL),(NULL),(NULL),(NULL);
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
select * from t1;
connection master;
drop table t1,t2;
-save_master_pos;
-connection slave;
-sync_with_master;
+sync_slave_with_master;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 15d44bcd672..34ad496f285 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -1751,6 +1751,10 @@ select wss_type from t1 where wss_type ='102935229216544104';
select wss_type from t1 where wss_type ='102935229216544093';
select wss_type from t1 where wss_type =102935229216544093;
drop table t1;
+select 1+2,"aaaa",3.13*2.0 into @a,@b,@c;
+select @a;
+select @b;
+select @c;
#
# Test of removing redundant braces in the FROM part
diff --git a/mysql-test/t/select_found.test b/mysql-test/t/select_found.test
index 0a483c860cb..316e7894344 100644
--- a/mysql-test/t/select_found.test
+++ b/mysql-test/t/select_found.test
@@ -84,4 +84,12 @@ INSERT INTO t1 (titre,maxnumrep) VALUES
('test1','1'),('test2','2'),('test3','3');
SELECT SQL_CALC_FOUND_ROWS titre,numeropost,maxnumrep FROM t1 WHERE numeropost IN (1,2) ORDER BY maxnumrep DESC LIMIT 0, 1;
SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS 1 FROM (SELECT 1) LIMIT 0;
+SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE numeropost > 1 LIMIT 0;
+SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 LIMIT 0;
+SELECT FOUND_ROWS();
+SELECT SQL_CALC_FOUND_ROWS * FROM t1 ORDER BY numeropost LIMIT 0;
+SELECT FOUND_ROWS();
drop table t1;
diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test
index 5e10ebf23a3..eb15eac8bad 100644
--- a/mysql-test/t/show_check.test
+++ b/mysql-test/t/show_check.test
@@ -49,9 +49,11 @@ drop table t2;
create table t1 (
test_set set( 'val1', 'val2', 'val3' ) not null default '',
- name char(20) default 'O''Brien'
+ name char(20) default 'O''Brien' comment 'O''Brien as default',
+ c int not null comment 'int column'
) comment = 'it\'s a table' ;
show create table t1 ;
+show full columns from t1;
drop table t1;
create table t1 (a int not null, unique aa (a));
@@ -78,6 +80,7 @@ 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;
+show full columns from t1;
drop table t1;
# Check auto conversions of types
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
new file mode 100644
index 00000000000..7a507be4ed2
--- /dev/null
+++ b/mysql-test/t/subselect.test
@@ -0,0 +1,184 @@
+select (select 2);
+SELECT (SELECT 1) UNION SELECT (SELECT 2);
+SELECT (SELECT (SELECT 0 UNION SELECT 0));
+-- error 1243
+SELECT (SELECT 1 FROM (SELECT 1) HAVING a=1) as a;
+-- error 1243
+SELECT (SELECT 1 FROM (SELECT 1) HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) HAVING a=1) as b;
+drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
+create table t1 (a int);
+create table t2 (a int, b int);
+create table t3 (a int);
+create table t4 (a int, b int);
+insert into t1 values (2);
+insert into t2 values (1,7),(2,7);
+insert into t4 values (4,8),(3,8),(5,9);
+select (select a from t1 where t1.a=t2.a), a from t2;
+select (select a from t1 where t1.a=t2.b), a from t2;
+select (select a from t1), a from t2;
+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)
+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)
+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)
+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
+(select * from t2 where a>1) as tt;
+explain select (select t3.a from t3 where a<8 order by 1 desc limit 1), a from
+(select * from t2 where a>1) as tt;
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a > t1.a) order by 1 desc limit 1);
+select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3 where t3.a < t1.a) order by 1 desc limit 1);
+select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+explain select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4;
+select * from t3 where exists (select * from t2 where t2.b=t3.a);
+select * from t3 where not exists (select * from t2 where t2.b=t3.a);
+insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9);
+select b,max(a) as ma from t4 group by b having b < (select max(t2.a)
+from t2 where t2.b=t4.b);
+select b,max(a) as ma from t4 group by b having b >= (select max(t2.a)
+from t2 where t2.b=t4.b);
+create table t5 (a int);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+insert into t5 values (5);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+insert into t5 values (2);
+select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2;
+-- error 1240
+select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2;
+create table attend (patient_uq int, clinic_uq int, index i1 (clinic_uq));
+create table clinic( uq int primary key, name char(25));
+insert into clinic values(1,"Oblastnaia bolnitsa"),(2,"Bolnitsa Krasnogo Kresta");
+insert into attend values (1,1),(1,2),(2,2),(1,3);
+select * from attend where exists (select * from clinic where uq = clinic_uq);
+
+# not unique fields
+-- error 1052
+select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
+
+# different tipes & group functions
+drop table if exists t1,t2,t3;
+
+CREATE TABLE t3 (a varchar(20),b char(1) NOT NULL default '0');
+INSERT INTO t3 VALUES ('W','a'),('A','c'),('J','b');
+CREATE TABLE t2 (a varchar(20),b int NOT NULL default '0');
+INSERT INTO t2 VALUES ('W','1'),('A','3'),('J','2');
+CREATE TABLE t1 (a varchar(20),b date NOT NULL default '0000-00-00');
+INSERT INTO t1 VALUES ('W','1732-02-22'),('A','1735-10-30'),('J','1743-04-13');
+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 inscrit;
+
+CREATE TABLE `inscrit` (
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ `email` varchar(60) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`pseudo`),
+ UNIQUE KEY `email` (`email`)
+) TYPE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
+
+INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
+INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
+INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
+EXPLAIN SELECT pseudo,(SELECT email FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce')) FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
+-- error 1239
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo,email FROM
+inscrit WHERE pseudo='joce');
+-- error 1239
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT * FROM inscrit WHERE
+pseudo='joce');
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
+-- error 1240
+SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo LIKE '%joce%');
+
+drop table if exists t1,t2,t3,t4,t5,attend,clinic,inscrit;
+
+drop table if exists searchconthardwarefr3;
+CREATE TABLE `searchconthardwarefr3` (
+ `topic` mediumint(8) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ `pseudo` varchar(35) character set latin1 NOT NULL default '',
+ PRIMARY KEY (`pseudo`,`date`,`topic`),
+ KEY `topic` (`topic`)
+) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
+INSERT INTO searchconthardwarefr3 (topic,date,pseudo) VALUES
+('43506','2002-10-02','joce'),('40143','2002-08-03','joce');
+EXPLAIN SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
+EXPLAIN SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
+SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03';
+SELECT (SELECT DISTINCT date FROM searchconthardwarefr3 WHERE date='2002-08-03');
+SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1;
+-- error 1240
+SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1;
+EXPLAIN SELECT 1 FROM searchconthardwarefr3 WHERE 1=(SELECT 1 UNION SELECT 1);
+drop table searchconthardwarefr3;
+
+drop table if exists forumconthardwarefr7, searchconthardwarefr7;
+CREATE TABLE `forumconthardwarefr7` (
+ `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+ `maxnumrep` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`),
+ UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) TYPE=MyISAM ROW_FORMAT=FIXED;
+
+INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (40143,1),(43506,2);
+
+CREATE TABLE `searchconthardwarefr7` (
+ `mot` varchar(30) NOT NULL default '',
+ `topic` mediumint(8) unsigned NOT NULL default '0',
+ `date` date NOT NULL default '0000-00-00',
+ `pseudo` varchar(35) NOT NULL default '',
+ PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`)
+ ) TYPE=MyISAM ROW_FORMAT=DYNAMIC;
+
+INSERT INTO searchconthardwarefr7 (mot,topic,date,pseudo) VALUES ('joce','40143','2002-10-22','joce'), ('joce','43506','2002-10-22','joce');
+select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+SELECT numeropost,maxnumrep FROM forumconthardwarefr7 WHERE exists (SELECT 1 FROM searchconthardwarefr7 WHERE (mot='joce') AND date >= '2002-10-21' AND forumconthardwarefr7.numeropost = searchconthardwarefr7.topic) ORDER BY maxnumrep DESC LIMIT 0, 20;
+-- error 1054
+SELECT (SELECT 1) as a FROM (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+drop table forumconthardwarefr7, searchconthardwarefr7;
+
+drop table if exists forumconthardwarefr7;
+CREATE TABLE `forumconthardwarefr7` (
+ `numeropost` mediumint(8) unsigned NOT NULL auto_increment,
+ `maxnumrep` int(10) unsigned NOT NULL default '0',
+ PRIMARY KEY (`numeropost`),
+ UNIQUE KEY `maxnumrep` (`maxnumrep`)
+) TYPE=MyISAM ROW_FORMAT=FIXED;
+
+INSERT INTO forumconthardwarefr7 (numeropost,maxnumrep) VALUES (1,0),(2,1);
+-- error 1240
+select numeropost as a FROM forumconthardwarefr7 GROUP BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+-- error 1240
+select numeropost as a FROM forumconthardwarefr7 ORDER BY (SELECT 1 FROM forumconthardwarefr7 HAVING a=1);
+drop table if exists forumconthardwarefr7;
+
+drop table if exists iftest;
+CREATE TABLE iftest (field char(1) NOT NULL DEFAULT 'b');
+INSERT INTO iftest VALUES ();
+-- error 1240
+SELECT field FROM iftest WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) HAVING field='b');
+drop table iftest;
+
+drop table if exists threadhardwarefr7;
+CREATE TABLE `threadhardwarefr7` (
+ `numeropost` mediumint(8) unsigned NOT NULL default '0',
+ `numreponse` int(10) unsigned NOT NULL auto_increment,
+ `pseudo` varchar(35) NOT NULL default '',
+ PRIMARY KEY (`numeropost`,`numreponse`),
+ UNIQUE KEY `numreponse` (`numreponse`),
+ KEY `pseudo` (`pseudo`,`numeropost`)
+) TYPE=MyISAM;
+INSERT INTO threadhardwarefr7 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test');
+-- error 1240
+EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM threadhardwarefr7 WHERE numeropost='1');
+EXPLAIN SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1';
+EXPLAIN SELECT numreponse FROM threadhardwarefr7 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM threadhardwarefr7 WHERE numeropost='1');
+drop table if exists threadhardwarefrtest7;
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 2b23617ec8b..234daeabc2b 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -1,8 +1,34 @@
#
+# Basic cleanup
+#
+drop table if exists t1,t2,t3,t4,t5,t6,t7;
+
+#
+# Check syntax for creating BLOB/TEXT
+#
+
+CREATE TABLE t1 (a blob, b text, c blob(250), d text(70000), e text(70000000));
+show columns from t1;
+CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000));
+show columns from t2;
+create table t3 (a long, b long byte);
+show create TABLE t3;
+drop table t1,t2,t3
+
+#
+# Check errors with blob
+#
+
+--error 1074
+CREATE TABLE t1 (a char(257) default "hello");
+--error 1101
+CREATE TABLE t2 (a blob default "hello");
+drop table if exists t1,t2;
+
+#
# test of full join with blob
#
-drop table if exists t1,t2,t3,t4,t5,t6,t7;
create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr));
insert into t1 values (null,"a","A");
insert into t1 values (null,"bbb","BBB");
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 6e6b43ebe3b..f43308f2f55 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -21,7 +21,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1);
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
-(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
+#(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
select found_rows();
#
@@ -98,3 +98,6 @@ set SQL_SELECT_LIMIT=2;
(select * from t1 limit 1) union (select * from t2 limit 3);
set SQL_SELECT_LIMIT=DEFAULT;
drop table t1,t2;
+
+--error 1096
+select * union select 1;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index e21fbd975e6..552777743f8 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -34,7 +34,8 @@ drop table t1;
set max_join_size=100;
show variables like 'max_join_size';
-show global variables like 'max_join_size';
+# Removed, because it has different value with/without BIG_TABLES
+#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;