summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <ramil@mysql.com>2005-02-28 19:59:38 +0400
committerunknown <ramil@mysql.com>2005-02-28 19:59:38 +0400
commitf9dd79c77d3690cee26aeb0949b74ac76fccdcae (patch)
tree6f12cb96c51f12a54cc4aaabfbed0b10a5a08834 /mysql-test/r
parent3bffc522317ad18102f8a2e5079e3242b6866dcf (diff)
parentc8b3d65ca26ff2be783115da2fb7c790dd4338e4 (diff)
downloadmariadb-git-f9dd79c77d3690cee26aeb0949b74ac76fccdcae.tar.gz
merging
mysql-test/r/ps.result: Auto merged sql/sql_class.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/alter_table.result17
-rw-r--r--mysql-test/r/analyse.result42
-rw-r--r--mysql-test/r/binary.result7
-rw-r--r--mysql-test/r/case.result12
-rw-r--r--mysql-test/r/cast.result9
-rw-r--r--mysql-test/r/compare.result6
-rw-r--r--mysql-test/r/consistent_snapshot.result15
-rw-r--r--mysql-test/r/ctype_big5.result77
-rw-r--r--mysql-test/r/ctype_cp1251.result16
-rw-r--r--mysql-test/r/ctype_create.result9
-rw-r--r--mysql-test/r/ctype_latin1.result34
-rw-r--r--mysql-test/r/ctype_latin1_de.result21
-rw-r--r--mysql-test/r/ctype_mb.result4
-rw-r--r--mysql-test/r/ctype_recoding.result74
-rw-r--r--mysql-test/r/ctype_sjis.result35
-rw-r--r--mysql-test/r/ctype_tis620.result58
-rw-r--r--mysql-test/r/ctype_uca.result81
-rw-r--r--mysql-test/r/ctype_ucs.result147
-rw-r--r--mysql-test/r/ctype_ujis.result2101
-rw-r--r--mysql-test/r/ctype_utf8.result54
-rw-r--r--mysql-test/r/date_formats.result3
-rw-r--r--mysql-test/r/delete.result39
-rw-r--r--mysql-test/r/derived.result28
-rw-r--r--mysql-test/r/distinct.result2
-rw-r--r--mysql-test/r/drop.result1
-rw-r--r--mysql-test/r/drop_temp_table.result14
-rw-r--r--mysql-test/r/flush_block_commit.result16
-rw-r--r--mysql-test/r/fulltext.result53
-rw-r--r--mysql-test/r/fulltext_cache.result36
-rw-r--r--mysql-test/r/fulltext_order_by.result54
-rw-r--r--mysql-test/r/func_compress.result4
-rw-r--r--mysql-test/r/func_concat.result32
-rw-r--r--mysql-test/r/func_gconcat.result5
-rw-r--r--mysql-test/r/func_group.result28
-rw-r--r--mysql-test/r/func_in.result14
-rw-r--r--mysql-test/r/func_math.result2
-rw-r--r--mysql-test/r/func_misc.result21
-rw-r--r--mysql-test/r/func_sapdb.result7
-rw-r--r--mysql-test/r/func_str.result61
-rw-r--r--mysql-test/r/func_time.result9
-rw-r--r--mysql-test/r/gis-rtree.result47
-rw-r--r--mysql-test/r/gis.result74
-rw-r--r--mysql-test/r/grant.result150
-rw-r--r--mysql-test/r/grant2.result17
-rw-r--r--mysql-test/r/grant_cache.result6
-rw-r--r--mysql-test/r/group_by.result39
-rw-r--r--mysql-test/r/have_exampledb.require2
-rw-r--r--mysql-test/r/have_moscow_leap_timezone.require2
-rw-r--r--mysql-test/r/have_openssl_1.require2
-rw-r--r--mysql-test/r/heap.result24
-rw-r--r--mysql-test/r/heap_hash.result170
-rw-r--r--mysql-test/r/innodb.result18
-rw-r--r--mysql-test/r/innodb.result.es1653
-rw-r--r--mysql-test/r/insert_select.result21
-rw-r--r--mysql-test/r/insert_select.result.es19
-rw-r--r--mysql-test/r/insert_update.result62
-rw-r--r--mysql-test/r/join_outer.result65
-rw-r--r--mysql-test/r/key.result18
-rw-r--r--mysql-test/r/key_cache.result10
-rw-r--r--mysql-test/r/limit.result9
-rw-r--r--mysql-test/r/lowercase_table2.result28
-rw-r--r--mysql-test/r/lowercase_table3.result2
-rw-r--r--mysql-test/r/lowercase_table_grant.result23
-rw-r--r--mysql-test/r/merge.result30
-rw-r--r--mysql-test/r/metadata.result8
-rw-r--r--mysql-test/r/mix_innodb_myisam_binlog.result21
-rw-r--r--mysql-test/r/multi_statement.result17
-rw-r--r--mysql-test/r/multi_update.result11
-rw-r--r--mysql-test/r/myisam-blob.result.es59
-rw-r--r--mysql-test/r/myisam.result3
-rw-r--r--mysql-test/r/mysqldump.result237
-rw-r--r--mysql-test/r/mysqltest.result131
-rw-r--r--mysql-test/r/ndb_alter_table.result16
-rw-r--r--mysql-test/r/ndb_autodiscover.result7
-rw-r--r--mysql-test/r/ndb_autodiscover2.result3
-rw-r--r--mysql-test/r/ndb_basic.result193
-rw-r--r--mysql-test/r/ndb_blob.result294
-rw-r--r--mysql-test/r/ndb_charset.result14
-rw-r--r--mysql-test/r/ndb_grant.result416
-rw-r--r--mysql-test/r/ndb_index_ordered.result270
-rw-r--r--mysql-test/r/ndb_index_unique.result112
-rw-r--r--mysql-test/r/ndb_insert.result74
-rw-r--r--mysql-test/r/ndb_restore.result249
-rw-r--r--mysql-test/r/ndb_update.result13
-rw-r--r--mysql-test/r/null.result94
-rw-r--r--mysql-test/r/openssl_1.result6
-rw-r--r--mysql-test/r/order_by.result55
-rw-r--r--mysql-test/r/preload.result28
-rw-r--r--mysql-test/r/ps.result38
-rw-r--r--mysql-test/r/ps_10nestset.result11
-rw-r--r--mysql-test/r/ps_1general.result61
-rw-r--r--mysql-test/r/ps_2myisam.result103
-rw-r--r--mysql-test/r/ps_3innodb.result103
-rw-r--r--mysql-test/r/ps_4heap.result135
-rw-r--r--mysql-test/r/ps_5merge.result200
-rw-r--r--mysql-test/r/ps_6bdb.result103
-rw-r--r--mysql-test/r/ps_7ndb.result222
-rw-r--r--mysql-test/r/query_cache.result13
-rw-r--r--mysql-test/r/query_cache.result.es23
-rw-r--r--mysql-test/r/range.result20
-rw-r--r--mysql-test/r/rpl_charset.result123
-rw-r--r--mysql-test/r/rpl_create_database.result83
-rw-r--r--mysql-test/r/rpl_drop_temp.result12
-rw-r--r--mysql-test/r/rpl_failed_optimize.result15
-rw-r--r--mysql-test/r/rpl_insert_id.result5
-rw-r--r--mysql-test/r/rpl_insert_ignore.result70
-rw-r--r--mysql-test/r/rpl_loaddata_rule_m.result2
-rw-r--r--mysql-test/r/rpl_many_optimize.result9
-rw-r--r--mysql-test/r/rpl_multi_query.result32
-rw-r--r--mysql-test/r/rpl_multi_update2.result42
-rw-r--r--mysql-test/r/rpl_rewrite_db.result92
-rw-r--r--mysql-test/r/rpl_start_stop_slave.result12
-rw-r--r--mysql-test/r/select.result61
-rw-r--r--mysql-test/r/select.result.es29
-rw-r--r--mysql-test/r/select_found.result9
-rw-r--r--mysql-test/r/show_check.result112
-rw-r--r--mysql-test/r/skip_name_resolve.result7
-rw-r--r--mysql-test/r/sql_mode.result30
-rw-r--r--mysql-test/r/subselect.result295
-rw-r--r--mysql-test/r/subselect_innodb.result38
-rw-r--r--mysql-test/r/system_mysql_db.result100
-rw-r--r--mysql-test/r/timezone2.result44
-rw-r--r--mysql-test/r/timezone3.result41
-rw-r--r--mysql-test/r/type_blob.result4
-rw-r--r--mysql-test/r/type_blob.result.es4
-rw-r--r--mysql-test/r/type_date.result8
-rw-r--r--mysql-test/r/type_datetime.result21
-rw-r--r--mysql-test/r/type_enum.result52
-rw-r--r--mysql-test/r/type_float.result98
-rw-r--r--mysql-test/r/type_float.result.es66
-rw-r--r--mysql-test/r/type_set.result18
-rw-r--r--mysql-test/r/type_timestamp.result10
-rw-r--r--mysql-test/r/union.result86
-rw-r--r--mysql-test/r/update.result13
-rw-r--r--mysql-test/r/user_var.result46
-rw-r--r--mysql-test/r/variables.result15
-rw-r--r--mysql-test/r/warnings.result27
137 files changed, 9905 insertions, 928 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index e85ad303564..7d2b3f01ae6 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -121,7 +121,7 @@ create database mysqltest;
create table mysqltest.t1 (a int,b int,c int);
grant all on mysqltest.t1 to mysqltest_1@localhost;
alter table t1 rename t2;
-ERROR 42000: insert command denied to user 'mysqltest_1'@'localhost' for table 't2'
+ERROR 42000: INSERT,CREATE command denied to user 'mysqltest_1'@'localhost' for table 't2'
revoke all privileges on mysqltest.t1 from mysqltest_1@localhost;
delete from mysql.user where user=_binary'mysqltest_1';
drop database mysqltest;
@@ -349,6 +349,7 @@ alter table t1 change a a char(10) character set koi8r;
select a,hex(a) from t1;
a hex(a)
ÔÅÓÔ D4C5D3D4
+delete from t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -482,3 +483,17 @@ ERROR 42000: Incorrect table name 't1\\'
rename table t1 to `t1\\`;
ERROR 42000: Incorrect table name 't1\\'
drop table t1;
+create table t1 (a text) character set koi8r;
+insert into t1 values (_koi8r'ÔÅÓÔ');
+select hex(a) from t1;
+hex(a)
+D4C5D3D4
+alter table t1 convert to character set cp1251;
+select hex(a) from t1;
+hex(a)
+F2E5F1F2
+drop table t1;
+create table t1 ( a timestamp );
+alter table t1 add unique ( a(1) );
+ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
+drop table t1;
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result
index b51afab5b54..09c606b5a04 100644
--- a/mysql-test/r/analyse.result
+++ b/mysql-test/r/analyse.result
@@ -36,16 +36,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `Field_name` char(255) NOT NULL default '',
- `Min_value` char(255) default NULL,
- `Max_value` char(255) default NULL,
+ `Field_name` binary(255) NOT NULL default '',
+ `Min_value` binary(255) default NULL,
+ `Max_value` binary(255) default NULL,
`Min_length` bigint(11) NOT NULL default '0',
`Max_length` bigint(11) NOT NULL default '0',
`Empties_or_zeros` bigint(11) NOT NULL default '0',
`Nulls` bigint(11) NOT NULL default '0',
- `Avg_value_or_avg_length` char(255) NOT NULL default '',
- `Std` char(255) default NULL,
- `Optimal_fieldtype` char(64) NOT NULL default ''
+ `Avg_value_or_avg_length` binary(255) NOT NULL default '',
+ `Std` binary(255) default NULL,
+ `Optimal_fieldtype` binary(64) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t1 where 0=1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
@@ -55,16 +55,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `Field_name` char(255) NOT NULL default '',
- `Min_value` char(255) default NULL,
- `Max_value` char(255) default NULL,
+ `Field_name` binary(255) NOT NULL default '',
+ `Min_value` binary(255) default NULL,
+ `Max_value` binary(255) default NULL,
`Min_length` bigint(11) NOT NULL default '0',
`Max_length` bigint(11) NOT NULL default '0',
`Empties_or_zeros` bigint(11) NOT NULL default '0',
`Nulls` bigint(11) NOT NULL default '0',
- `Avg_value_or_avg_length` char(255) NOT NULL default '',
- `Std` char(255) default NULL,
- `Optimal_fieldtype` char(64) NOT NULL default ''
+ `Avg_value_or_avg_length` binary(255) NOT NULL default '',
+ `Std` binary(255) default NULL,
+ `Optimal_fieldtype` binary(64) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
@@ -78,16 +78,16 @@ create table t2 select * from t1 where 0=1 procedure analyse();
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `Field_name` char(255) NOT NULL default '',
- `Min_value` char(255) default NULL,
- `Max_value` char(255) default NULL,
+ `Field_name` binary(255) NOT NULL default '',
+ `Min_value` binary(255) default NULL,
+ `Max_value` binary(255) default NULL,
`Min_length` bigint(11) NOT NULL default '0',
`Max_length` bigint(11) NOT NULL default '0',
`Empties_or_zeros` bigint(11) NOT NULL default '0',
`Nulls` bigint(11) NOT NULL default '0',
- `Avg_value_or_avg_length` char(255) NOT NULL default '',
- `Std` char(255) default NULL,
- `Optimal_fieldtype` char(64) NOT NULL default ''
+ `Avg_value_or_avg_length` binary(255) NOT NULL default '',
+ `Std` binary(255) default NULL,
+ `Optimal_fieldtype` binary(64) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
@@ -96,3 +96,9 @@ select * from t2;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
drop table t1,t2;
+create table t1 (v varchar(128));
+insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
+select * from t1 procedure analyse();
+Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
+test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
+drop table t1;
diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result
index 405de1158d6..5b5f673b071 100644
--- a/mysql-test/r/binary.result
+++ b/mysql-test/r/binary.result
@@ -134,3 +134,10 @@ select * from t1 where firstname='john' and firstname like binary 'John';
firstname lastname
John Doe
drop table t1;
+create table t1 (a binary);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` binary(1) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index 1aa838140fd..541560afd36 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -98,10 +98,10 @@ Table Create Table
t1 CREATE TABLE `t1` (
`c1` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
`c2` char(1) character set latin1 collate latin1_danish_ci NOT NULL default '',
- `c3` char(1) NOT NULL default '',
- `c4` char(1) NOT NULL default '',
- `c5` char(3) NOT NULL default '',
- `c6` char(3) NOT NULL default '',
+ `c3` binary(1) NOT NULL default '',
+ `c4` binary(1) NOT NULL default '',
+ `c5` binary(3) NOT NULL default '',
+ `c6` binary(3) NOT NULL default '',
`c7` double(3,1) NOT NULL default '0.0',
`c8` double(3,1) NOT NULL default '0.0',
`c9` double(3,1) default NULL
@@ -149,8 +149,8 @@ t1 CREATE TABLE `t1` (
`COALESCE(1.0)` double(3,1) NOT NULL default '0.0',
`COALESCE('a')` char(1) NOT NULL default '',
`COALESCE(1,1.0)` double(3,1) NOT NULL default '0.0',
- `COALESCE(1,'1')` char(1) NOT NULL default '',
- `COALESCE(1.1,'1')` char(3) NOT NULL default '',
+ `COALESCE(1,'1')` binary(1) NOT NULL default '',
+ `COALESCE(1.1,'1')` binary(3) NOT NULL default '',
`COALESCE('a' COLLATE latin1_bin,'b')` char(1) character set latin1 collate latin1_bin NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index ccf75f68e88..636e2603f9b 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -178,3 +178,12 @@ aaa aa
aab aa
aac aa
DROP TABLE t1;
+select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
+date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour)
+2004-12-30 00:00:00
+select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
+timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
+00:00:00
+select timediff(cast('1 12:00:00' as time), '12:00:00');
+timediff(cast('1 12:00:00' as time), '12:00:00')
+24:00:00
diff --git a/mysql-test/r/compare.result b/mysql-test/r/compare.result
index bf8a5106044..6f667aabac0 100644
--- a/mysql-test/r/compare.result
+++ b/mysql-test/r/compare.result
@@ -36,3 +36,9 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
6109 -1 -1
61 0 0
DROP TABLE t1;
+SELECT CHAR(31) = '', '' = CHAR(31);
+CHAR(31) = '' '' = CHAR(31)
+0 0
+SELECT CHAR(30) = '', '' = CHAR(30);
+CHAR(30) = '' '' = CHAR(30)
+0 0
diff --git a/mysql-test/r/consistent_snapshot.result b/mysql-test/r/consistent_snapshot.result
new file mode 100644
index 00000000000..90606abbe4e
--- /dev/null
+++ b/mysql-test/r/consistent_snapshot.result
@@ -0,0 +1,15 @@
+drop table if exists t1;
+create table t1 (a int) engine=innodb;
+start transaction with consistent snapshot;
+insert into t1 values(1);
+select * from t1;
+a
+commit;
+delete from t1;
+start transaction;
+insert into t1 values(1);
+select * from t1;
+a
+1
+commit;
+drop table t1;
diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result
index 44fad0cd96a..8f4ee3d0558 100644
--- a/mysql-test/r/ctype_big5.result
+++ b/mysql-test/r/ctype_big5.result
@@ -1,10 +1,79 @@
drop table if exists t1;
-SET NAMES big5;
-CREATE TABLE t1 (c CHAR(10) CHARACTER SET big5, KEY(c));
+SET @test_character_set= 'big5';
+SET @test_collation= 'big5_chinese_ci';
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
-SELECT * FROM t1 WHERE c LIKE 'aaa%';
-c
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 varchar(15) big5_chinese_ci YES MUL NULL
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'location%';
+want1result
+location
+DROP TABLE t1;
+DROP DATABASE d1;
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
+SET NAMES big5;
+SET collation_connection='big5_chinese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+big5_chinese_ci 6109
+big5_chinese_ci 61
+big5_chinese_ci 6120
+drop table t1;
+SET collation_connection='big5_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+big5_bin 6109
+big5_bin 61
+big5_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index 3793e962d40..647f8c6236c 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -54,3 +54,19 @@ select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc')
cp1251_bin binary binary
drop table t1;
+create table t1 (
+a varchar(16) character set cp1251 collate cp1251_bin not null,
+b int(10) default null,
+primary key(a)
+) charset=cp1251;
+insert into t1 (a) values ('air'),
+('we'),('g'),('we_toshko'), ('s0urce'),('we_ivo'),('we_iliyan'),
+('we_martin'),('vw_grado'),('vw_vasko'),('tn_vili'),('tn_kalina'),
+('tn_fakira'),('vw_silvia'),('vw_starshi'),('vw_geo'),('vw_b0x1');
+select * from t1 where a like 'we_%';
+a b
+we_iliyan NULL
+we_ivo NULL
+we_martin NULL
+we_toshko NULL
+drop table t1;
diff --git a/mysql-test/r/ctype_create.result b/mysql-test/r/ctype_create.result
index b35131f62a4..63bae33c6e1 100644
--- a/mysql-test/r/ctype_create.result
+++ b/mysql-test/r/ctype_create.result
@@ -63,3 +63,12 @@ ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET
create database d1 default character set latin1 collate latin2_bin;
ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1'
DROP DATABASE mysqltest1;
+CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
+use mysqltest2;
+ALTER DATABASE DEFAULT CHARACTER SET latin2;
+show create database mysqltest2;
+Database Create Database
+mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin2 */
+drop database mysqltest2;
+ALTER DATABASE DEFAULT CHARACTER SET latin2;
+ERROR 3D000: No database selected
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index a8182438ac4..21c40e24fe2 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -296,3 +296,37 @@ FD C3BD FD 1
FE C3BE FE 1
FF C3BF FF 1
DROP TABLE t1;
+select 'a' regexp 'A' collate latin1_general_ci;
+'a' regexp 'A' collate latin1_general_ci
+1
+select 'a' regexp 'A' collate latin1_general_cs;
+'a' regexp 'A' collate latin1_general_cs
+0
+select 'a' regexp 'A' collate latin1_bin;
+'a' regexp 'A' collate latin1_bin
+0
+SET collation_connection='latin1_swedish_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+latin1_swedish_ci 6109
+latin1_swedish_ci 61
+latin1_swedish_ci 6120
+drop table t1;
+SET collation_connection='latin1_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+latin1_bin 6109
+latin1_bin 61
+latin1_bin 6120
+drop table t1;
+CREATE TABLE „a (a int);
+ERROR 42000: 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 '„a (a int)' at line 1
+SELECT '„a' as str;
+str
+„a
diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result
index 50af5464f54..f57d8c191bf 100644
--- a/mysql-test/r/ctype_latin1_de.result
+++ b/mysql-test/r/ctype_latin1_de.result
@@ -317,3 +317,24 @@ FIELD('ue',s1) FIELD('Ü',s1) s1='ue' s1='Ü'
1 1 1 1
1 1 1 1
DROP TABLE t1;
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+latin1_german2_ci 6109
+latin1_german2_ci 61
+latin1_german2_ci 6120
+drop table t1;
+SET NAMES latin1;
+CREATE TABLE t1 (
+col1 varchar(255) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 collate latin1_german2_ci;
+INSERT INTO t1 VALUES ('ß'),('ss'),('ss');
+ALTER TABLE t1 ADD KEY ifword(col1);
+SELECT * FROM t1 WHERE col1='ß' ORDER BY col1, BINARY col1;
+col1
+ss
+ss
+DROP TABLE t1;
diff --git a/mysql-test/r/ctype_mb.result b/mysql-test/r/ctype_mb.result
index 5e273b3c800..dbdb9c1343c 100644
--- a/mysql-test/r/ctype_mb.result
+++ b/mysql-test/r/ctype_mb.result
@@ -33,7 +33,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 key_a 1 a A NULL 9 NULL YES BTREE
+t1 1 key_a 1 a A NULL 3 NULL YES BTREE
ALTER TABLE t1 CHANGE a a CHAR(4);
SHOW CREATE TABLE t1;
Table Create Table
@@ -53,5 +53,5 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW KEYS FROM t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 key_a 1 a A NULL 9 NULL YES BTREE
+t1 1 key_a 1 a A NULL 3 NULL YES BTREE
DROP TABLE t1;
diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result
index be792c007fc..1c75988fd21 100644
--- a/mysql-test/r/ctype_recoding.result
+++ b/mysql-test/r/ctype_recoding.result
@@ -166,3 +166,77 @@ ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ'
SET NAMES utf8;
CREATE TABLE `goodÐÌÏÈÏ` (a int);
ERROR HY000: Invalid utf8 character string: 'ÐÌÏÈÏ` (a int)'
+set names latin1;
+create table t1 (a char(10) character set koi8r, b text character set koi8r);
+insert into t1 values ('test','test');
+insert into t1 values ('ÊÃÕË','ÊÃÕË');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'b' at row 1
+drop table t1;
+set names koi8r;
+create table t1 (a char(10) character set cp1251);
+insert into t1 values (_koi8r'×ÁÓÑ');
+select * from t1 where a=_koi8r'×ÁÓÑ';
+a
+×ÁÓÑ
+select * from t1 where a=concat(_koi8r'×ÁÓÑ');
+ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
+select * from t1 where a=_latin1'×ÁÓÑ';
+ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
+drop table t1;
+set names latin1;
+set names koi8r;
+create table t1 (c1 char(10) character set cp1251);
+insert into t1 values ('ß');
+select c1 from t1 where c1 between 'ß' and 'ß';
+c1
+select ifnull(c1,'ß'), ifnull(null,c1) from t1;
+ifnull(c1,'ß') ifnull(null,c1)
+ß ß
+select if(1,c1,'ö'), if(0,c1,'ö') from t1;
+if(1,c1,'ö') if(0,c1,'ö')
+ß ö
+select coalesce('ö',c1), coalesce(null,c1) from t1;
+coalesce('ö',c1) coalesce(null,c1)
+ö ß
+select least(c1,'ö'), greatest(c1,'ö') from t1;
+least(c1,'ö') greatest(c1,'ö')
+ö ß
+select locate(c1,'ß'), locate('ß',c1) from t1;
+locate(c1,'ß') locate('ß',c1)
+1 1
+select field(c1,'ß'),field('ß',c1) from t1;
+field(c1,'ß') field('ß',c1)
+1 1
+select concat(c1,'ö'), concat('ö',c1) from t1;
+concat(c1,'ö') concat('ö',c1)
+ßö öß
+select concat_ws(c1,'ö','ß'), concat_ws('ö',c1,'ß') from t1;
+concat_ws(c1,'ö','ß') concat_ws('ö',c1,'ß')
+ößß ßöß
+select replace(c1,'ß','ö'), replace('ß',c1,'ö') from t1;
+replace(c1,'ß','ö') replace('ß',c1,'ö')
+ö ö
+select substring_index(c1,'öößß',2) from t1;
+substring_index(c1,'öößß',2)
+select elt(1,c1,'ö'),elt(1,'ö',c1) from t1;
+elt(1,c1,'ö') elt(1,'ö',c1)
+ß ö
+select make_set(3,c1,'ö'), make_set(3,'ö',c1) from t1;
+make_set(3,c1,'ö') make_set(3,'ö',c1)
+ß,ö ö,ß
+select insert(c1,1,2,'ö'),insert('ö',1,2,c1) from t1;
+insert(c1,1,2,'ö') insert('ö',1,2,c1)
+ö ß
+select trim(c1 from 'ß'),trim('ß' from c1) from t1;
+trim(c1 from 'ß') trim('ß' from c1)
+
+select lpad(c1,3,'ö'), lpad('ö',3,c1) from t1;
+lpad(c1,3,'ö') lpad('ö',3,c1)
+ööß ßßö
+select rpad(c1,3,'ö'), rpad('ö',3,c1) from t1;
+rpad(c1,3,'ö') rpad('ö',3,c1)
+ßöö ößß
diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result
index b0edbed1a41..98e5992f374 100644
--- a/mysql-test/r/ctype_sjis.result
+++ b/mysql-test/r/ctype_sjis.result
@@ -60,3 +60,38 @@ hex(c)
9353
9373
drop table t1;
+SET NAMES sjis;
+CREATE TABLE t1 (
+c char(16) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=sjis;
+insert into t1 values(0xb1),(0xb2),(0xb3);
+select hex(c) from t1;
+hex(c)
+B1
+B2
+B3
+drop table t1;
+SET collation_connection='sjis_japanese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+sjis_japanese_ci 6109
+sjis_japanese_ci 61
+sjis_japanese_ci 6120
+drop table t1;
+SET collation_connection='sjis_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+sjis_bin 6109
+sjis_bin 61
+sjis_bin 6120
+drop table t1;
+SET NAMES sjis;
+SELECT HEX('²“‘@\Œ\') FROM DUAL;
+HEX('²“‘@_Œ\')
+8DB2939181408C5C
diff --git a/mysql-test/r/ctype_tis620.result b/mysql-test/r/ctype_tis620.result
index 1fece515f9f..6d8bfe74c4b 100644
--- a/mysql-test/r/ctype_tis620.result
+++ b/mysql-test/r/ctype_tis620.result
@@ -2899,3 +2899,61 @@ hex(a) STRCMP(a,'a') STRCMP(a,'a ')
6109 -1 -1
61 0 0
DROP TABLE t1;
+CREATE TABLE t1 (
+`id` int(11) NOT NULL auto_increment,
+`url` varchar(200) NOT NULL default '',
+`name` varchar(250) NOT NULL default '',
+`type` int(11) NOT NULL default '0',
+`website` varchar(250) NOT NULL default '',
+`adddate` date NOT NULL default '0000-00-00',
+`size` varchar(20) NOT NULL default '',
+`movieid` int(11) NOT NULL default '0',
+`musicid` int(11) NOT NULL default '0',
+`star` varchar(20) NOT NULL default '',
+`download` int(11) NOT NULL default '0',
+`lastweek` int(11) NOT NULL default '0',
+`thisweek` int(11) NOT NULL default '0',
+`page` varchar(250) NOT NULL default '',
+PRIMARY KEY (`id`),
+UNIQUE KEY `url` (`url`)
+) CHARACTER SET tis620;
+INSERT INTO t1 VALUES
+(1,'http://www.siamzone.com/download/download/000001-frodo_1024.jpg','The Lord
+of the Rings
+Wallpapers',1,'http://www.lordoftherings.net','2002-01-22','',448,0,'',3805,0,0,
+'');
+INSERT INTO t1 VALUES (2,'http://www.othemovie.com/OScreenSaver1.EXE','O
+Screensaver',2,'','2002-01-22','',491,0,'',519,0,0,'');
+INSERT INTO t1 VALUES
+(3,'http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg','Jaso
+n X Wallpapers',1,'','2002-05-31','',579,0,'',1091,0,0,'');
+select * from t1 order by id;
+id url name type website adddate size movieid musicid star download lastweek thisweek page
+1 http://www.siamzone.com/download/download/000001-frodo_1024.jpg The Lord
+of the Rings
+Wallpapers 1 http://www.lordoftherings.net 2002-01-22 448 0 3805 0 0
+2 http://www.othemovie.com/OScreenSaver1.EXE O
+Screensaver 2 2002-01-22 491 0 519 0 0
+3 http://www.siamzone.com/download/download/000003-jasonx2(800x600).jpg Jaso
+n X Wallpapers 1 2002-05-31 579 0 1091 0 0
+DROP TABLE t1;
+SET collation_connection='tis620_thai_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+tis620_thai_ci 6109
+tis620_thai_ci 61
+tis620_thai_ci 6120
+drop table t1;
+SET collation_connection='tis620_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+tis620_bin 6109
+tis620_bin 61
+tis620_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result
index 90681795513..dd5a7ebf6a4 100644
--- a/mysql-test/r/ctype_uca.result
+++ b/mysql-test/r/ctype_uca.result
@@ -19,6 +19,9 @@ select 'a ' = 'a\t', 'a ' < 'a\t', 'a ' > 'a\t';
select 'a a' > 'a', 'a \t' < 'a';
'a a' > 'a' 'a \t' < 'a'
1 1
+select 'c' like '\_' as want0;
+want0
+0
CREATE TABLE t (
c char(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
@@ -2315,3 +2318,81 @@ HEX(CONVERT(col1 USING ucs2))
064A06A9062F064A06AF0631
064A06A9064A
DROP TABLE t1;
+SET @test_character_set= 'utf8';
+SET @test_collation= 'utf8_swedish_ci';
+SET @safe_character_set_server= @@character_set_server;
+SET @safe_collation_server= @@collation_server;
+SET character_set_server= @test_character_set;
+SET collation_server= @test_collation;
+CREATE DATABASE d1;
+USE d1;
+CREATE TABLE t1 (c CHAR(10), KEY(c));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c char(10) utf8_swedish_ci YES MUL NULL
+INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
+SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
+want3results
+aaa
+aaaa
+aaaaa
+DROP TABLE t1;
+CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
+SHOW FULL COLUMNS FROM t1;
+Field Type Collation Null Key Default Extra Privileges Comment
+c1 varchar(15) utf8_swedish_ci YES MUL NULL
+INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
+SELECT c1 as want3results from t1 where c1 like 'l%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want3results from t1 where c1 like 'lo%';
+want3results
+location
+loberge
+lotre
+SELECT c1 as want1result from t1 where c1 like 'loc%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'loca%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locat%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locati%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'locatio%';
+want1result
+location
+SELECT c1 as want1result from t1 where c1 like 'location%';
+want1result
+location
+DROP TABLE t1;
+DROP DATABASE d1;
+USE test;
+SET character_set_server= @safe_character_set_server;
+SET collation_server= @safe_collation_server;
+create table t1 (a varchar(1)) character set utf8 collate utf8_estonian_ci;
+insert into t1 values ('A'),('B'),('C'),('a'),('b'),('c');
+select a, a regexp '[a]' from t1 order by binary a;
+a a regexp '[a]'
+A 1
+B 0
+C 0
+a 1
+b 0
+c 0
+drop table t1;
+SET collation_connection='utf8_unicode_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+utf8_unicode_ci 6109
+utf8_unicode_ci 61
+utf8_unicode_ci 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 1d3deb0b09a..0807cfabf2a 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -1,4 +1,27 @@
DROP TABLE IF EXISTS t1;
+SET NAMES latin1;
+SET character_set_connection=ucs2;
+select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
+'a' = 'a' 'a' = 'a ' 'a ' = 'a'
+1 1 1
+select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
+'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a'
+0 1 0
+select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
+'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0'
+0 0 1
+select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
+'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a '
+0 1 0
+select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
+'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0'
+0 0 1
+select 'a a' > 'a', 'a \0' < 'a';
+'a a' > 'a' 'a \0' < 'a'
+1 1
+select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
+binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
+1 1 1
SET CHARACTER SET koi8r;
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (_koi8r'ò'), (X'2004');
@@ -480,3 +503,127 @@ a 0061
b 0062
c 0063
drop table t1;
+set @ivar= 1234;
+set @str1 = 'select ?';
+set @str2 = convert(@str1 using ucs2);
+prepare stmt1 from @str2;
+execute stmt1 using @ivar;
+?
+1234
+SET TIMESTAMP=10000;
+create table t2 (c char(30)) charset=ucs2;
+set @v=convert('abc' using ucs2);
+reset master;
+insert into t2 values (@v);
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 User var 1 79 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
+master-bin.000001 119 Query 1 119 use `test`; insert into t2 values (@v)
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`;
+use test;
+SET TIMESTAMP=10000;
+insert into t2 values (@v);
+drop table t2;
+set names latin1;
+create table t1 (a enum('x','y','z') character set ucs2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('x','y','z') character set ucs2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('x');
+insert into t1 values ('y');
+insert into t1 values ('z');
+select a, hex(a) from t1 order by a;
+a hex(a)
+x 0078
+y 0079
+z 007A
+alter table t1 change a a enum('x','y','z','d','e','ä','ö','ü') character set ucs2;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('x','y','z','d','e','ä','ö','ü') character set ucs2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('D');
+insert into t1 values ('E ');
+insert into t1 values ('Ä');
+insert into t1 values ('Ö');
+insert into t1 values ('Ü');
+select a, hex(a) from t1 order by a;
+a hex(a)
+x 0078
+y 0079
+z 007A
+d 0064
+e 0065
+ä 00E4
+ö 00F6
+ü 00FC
+drop table t1;
+create table t1 (a set ('x','y','z','ä','ö','ü') character set ucs2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` set('x','y','z','ä','ö','ü') character set ucs2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('x');
+insert into t1 values ('y');
+insert into t1 values ('z');
+insert into t1 values ('x,y');
+insert into t1 values ('x,y,z,Ä,Ö,Ü');
+select a, hex(a) from t1 order by a;
+a hex(a)
+x 0078
+y 0079
+x,y 0078002C0079
+z 007A
+x,y,z,ä,ö,ü 0078002C0079002C007A002C00E4002C00F6002C00FC
+drop table t1;
+create table t1(a enum('a','b','c')) default character set ucs2;
+insert into t1 values('a'),('b'),('c');
+alter table t1 add b char(1);
+show warnings;
+Level Code Message
+select * from t1 order by a;
+a b
+a NULL
+b NULL
+c NULL
+drop table t1;
+SET collation_connection='ucs2_general_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ucs2_general_ci 00610009
+ucs2_general_ci 0061
+ucs2_general_ci 00610020
+drop table t1;
+SET NAMES latin1;
+SET collation_connection='ucs2_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ucs2_bin 00610009
+ucs2_bin 0061
+ucs2_bin 00610020
+drop table t1;
+SET NAMES latin1;
+SET collation_connection='ucs2_swedish_ci';
+CREATE TABLE t1 (Field1 int(10) default '0');
+INSERT INTO t1 VALUES ('-1');
+SELECT * FROM t1;
+Field1
+-1
+DROP TABLE t1;
+CREATE TABLE t1 (Field1 int(10) unsigned default '0');
+INSERT INTO t1 VALUES ('-1');
+Warnings:
+Warning 1265 Data truncated for column 'Field1' at row 1
+DROP TABLE t1;
+SET NAMES latin1;
diff --git a/mysql-test/r/ctype_ujis.result b/mysql-test/r/ctype_ujis.result
index 7c3ae52cbc9..fd6c501499b 100644
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@ -126,3 +126,2104 @@ Field Type Null Key Default Extra
a char(1)
b enum('¤¢','¤¤') YES NULL
DROP TABLE t1;
+CREATE TABLE t1
+(
+a INTEGER NOT NULL,
+b VARCHAR(50) NOT NULL DEFAULT '',
+PRIMARY KEY (a),
+KEY b (b(10))
+) TYPE=InnoDB CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+a b
+0 aaabbbcccddd
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+a b
+1 eeefffggghhh
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+a b
+2 iiijjjkkkl
+DROP TABLE t1;
+CREATE TABLE t1
+(
+a INTEGER NOT NULL,
+b VARCHAR(50) NOT NULL DEFAULT '',
+PRIMARY KEY (a),
+KEY b (b(10))
+) TYPE=MyISAM CHARACTER SET 'ujis' COLLATE 'ujis_japanese_ci';
+INSERT INTO t1 (a, b) VALUES (0, 'aaabbbcccddd');
+INSERT INTO t1 (a, b) VALUES (1, 'eeefffggghhh');
+INSERT INTO t1 (a, b) VALUES (2, 'iiijjjkkkl');
+SELECT t1.* FROM t1 WHERE b='aaabbbcccddd' ORDER BY a;
+a b
+0 aaabbbcccddd
+SELECT t1.* FROM t1 WHERE b='eeefffggghhh' ORDER BY a;
+a b
+1 eeefffggghhh
+SELECT t1.* FROM t1 WHERE b='iiijjjkkkl' ORDER BY a;
+a b
+2 iiijjjkkkl
+DROP TABLE t1;
+DROP TABLE IF EXISTS t1;
+Warnings:
+Note 1051 Unknown table 't1'
+CREATE TABLE t1(c char(1)) character set ujis;
+INSERT INTO t1 VALUES(0xA2AF);
+INSERT INTO t1 VALUES(0xA2B0);
+INSERT INTO t1 VALUES(0xA2B1);
+INSERT INTO t1 VALUES(0xA2B2);
+INSERT INTO t1 VALUES(0xA2B3);
+INSERT INTO t1 VALUES(0xA2B4);
+INSERT INTO t1 VALUES(0xA2B5);
+INSERT INTO t1 VALUES(0xA2B6);
+INSERT INTO t1 VALUES(0xA2B7);
+INSERT INTO t1 VALUES(0xA2B8);
+INSERT INTO t1 VALUES(0xA2B9);
+INSERT INTO t1 VALUES(0xA2C2);
+INSERT INTO t1 VALUES(0xA2C3);
+INSERT INTO t1 VALUES(0xA2C4);
+INSERT INTO t1 VALUES(0xA2C5);
+INSERT INTO t1 VALUES(0xA2C6);
+INSERT INTO t1 VALUES(0xA2C7);
+INSERT INTO t1 VALUES(0xA2C8);
+INSERT INTO t1 VALUES(0xA2C9);
+INSERT INTO t1 VALUES(0xA2D1);
+INSERT INTO t1 VALUES(0xA2D2);
+INSERT INTO t1 VALUES(0xA2D3);
+INSERT INTO t1 VALUES(0xA2D4);
+INSERT INTO t1 VALUES(0xA2D5);
+INSERT INTO t1 VALUES(0xA2D6);
+INSERT INTO t1 VALUES(0xA2D7);
+INSERT INTO t1 VALUES(0xA2D8);
+INSERT INTO t1 VALUES(0xA2D9);
+INSERT INTO t1 VALUES(0xA2DA);
+INSERT INTO t1 VALUES(0xA2DB);
+INSERT INTO t1 VALUES(0xA2EB);
+INSERT INTO t1 VALUES(0xA2EC);
+INSERT INTO t1 VALUES(0xA2ED);
+INSERT INTO t1 VALUES(0xA2EE);
+INSERT INTO t1 VALUES(0xA2EF);
+INSERT INTO t1 VALUES(0xA2F0);
+INSERT INTO t1 VALUES(0xA2F1);
+INSERT INTO t1 VALUES(0xA2FA);
+INSERT INTO t1 VALUES(0xA2FB);
+INSERT INTO t1 VALUES(0xA2FC);
+INSERT INTO t1 VALUES(0xA2FD);
+INSERT INTO t1 VALUES(0xA3A1);
+INSERT INTO t1 VALUES(0xA3A2);
+INSERT INTO t1 VALUES(0xA3A3);
+INSERT INTO t1 VALUES(0xA3A4);
+INSERT INTO t1 VALUES(0xA3A5);
+INSERT INTO t1 VALUES(0xA3A6);
+INSERT INTO t1 VALUES(0xA3A7);
+INSERT INTO t1 VALUES(0xA3A8);
+INSERT INTO t1 VALUES(0xA3A9);
+INSERT INTO t1 VALUES(0xA3AA);
+INSERT INTO t1 VALUES(0xA3AB);
+INSERT INTO t1 VALUES(0xA3AC);
+INSERT INTO t1 VALUES(0xA3AD);
+INSERT INTO t1 VALUES(0xA3AE);
+INSERT INTO t1 VALUES(0xA3AF);
+INSERT INTO t1 VALUES(0xA3BA);
+INSERT INTO t1 VALUES(0xA3BB);
+INSERT INTO t1 VALUES(0xA3BC);
+INSERT INTO t1 VALUES(0xA3BD);
+INSERT INTO t1 VALUES(0xA3BE);
+INSERT INTO t1 VALUES(0xA3BF);
+INSERT INTO t1 VALUES(0xA3C0);
+INSERT INTO t1 VALUES(0xA3DB);
+INSERT INTO t1 VALUES(0xA3DC);
+INSERT INTO t1 VALUES(0xA3DD);
+INSERT INTO t1 VALUES(0xA3DE);
+INSERT INTO t1 VALUES(0xA3DF);
+INSERT INTO t1 VALUES(0xA3E0);
+INSERT INTO t1 VALUES(0xA3FB);
+INSERT INTO t1 VALUES(0xA3FC);
+INSERT INTO t1 VALUES(0xA3FD);
+INSERT INTO t1 VALUES(0xA3FE);
+INSERT INTO t1 VALUES(0xA4F4);
+INSERT INTO t1 VALUES(0xA4F5);
+INSERT INTO t1 VALUES(0xA4F6);
+INSERT INTO t1 VALUES(0xA4F7);
+INSERT INTO t1 VALUES(0xA4F8);
+INSERT INTO t1 VALUES(0xA4F9);
+INSERT INTO t1 VALUES(0xA4FA);
+INSERT INTO t1 VALUES(0xA4FB);
+INSERT INTO t1 VALUES(0xA4FC);
+INSERT INTO t1 VALUES(0xA4FD);
+INSERT INTO t1 VALUES(0xA4FE);
+INSERT INTO t1 VALUES(0xA5F7);
+INSERT INTO t1 VALUES(0xA5F8);
+INSERT INTO t1 VALUES(0xA5F9);
+INSERT INTO t1 VALUES(0xA5FA);
+INSERT INTO t1 VALUES(0xA5FB);
+INSERT INTO t1 VALUES(0xA5FC);
+INSERT INTO t1 VALUES(0xA5FD);
+INSERT INTO t1 VALUES(0xA5FE);
+INSERT INTO t1 VALUES(0xA6B9);
+INSERT INTO t1 VALUES(0xA6BA);
+INSERT INTO t1 VALUES(0xA6BB);
+INSERT INTO t1 VALUES(0xA6BC);
+INSERT INTO t1 VALUES(0xA6BD);
+INSERT INTO t1 VALUES(0xA6BE);
+INSERT INTO t1 VALUES(0xA6BF);
+INSERT INTO t1 VALUES(0xA6C0);
+INSERT INTO t1 VALUES(0xA6D9);
+INSERT INTO t1 VALUES(0xA6DA);
+INSERT INTO t1 VALUES(0xA6DB);
+INSERT INTO t1 VALUES(0xA6DC);
+INSERT INTO t1 VALUES(0xA6DD);
+INSERT INTO t1 VALUES(0xA6DE);
+INSERT INTO t1 VALUES(0xA6DF);
+INSERT INTO t1 VALUES(0xA6E0);
+INSERT INTO t1 VALUES(0xA6E1);
+INSERT INTO t1 VALUES(0xA6E2);
+INSERT INTO t1 VALUES(0xA6E3);
+INSERT INTO t1 VALUES(0xA6E4);
+INSERT INTO t1 VALUES(0xA6E5);
+INSERT INTO t1 VALUES(0xA6E6);
+INSERT INTO t1 VALUES(0xA6E7);
+INSERT INTO t1 VALUES(0xA6E8);
+INSERT INTO t1 VALUES(0xA6E9);
+INSERT INTO t1 VALUES(0xA6EA);
+INSERT INTO t1 VALUES(0xA6EB);
+INSERT INTO t1 VALUES(0xA6EC);
+INSERT INTO t1 VALUES(0xA6ED);
+INSERT INTO t1 VALUES(0xA6EE);
+INSERT INTO t1 VALUES(0xA6EF);
+INSERT INTO t1 VALUES(0xA6F0);
+INSERT INTO t1 VALUES(0xA6F1);
+INSERT INTO t1 VALUES(0xA6F2);
+INSERT INTO t1 VALUES(0xA6F3);
+INSERT INTO t1 VALUES(0xA6F4);
+INSERT INTO t1 VALUES(0xA6F5);
+INSERT INTO t1 VALUES(0xA6F6);
+INSERT INTO t1 VALUES(0xA6F7);
+INSERT INTO t1 VALUES(0xA6F8);
+INSERT INTO t1 VALUES(0xA6F9);
+INSERT INTO t1 VALUES(0xA6FA);
+INSERT INTO t1 VALUES(0xA6FB);
+INSERT INTO t1 VALUES(0xA6FC);
+INSERT INTO t1 VALUES(0xA6FD);
+INSERT INTO t1 VALUES(0xA6FE);
+INSERT INTO t1 VALUES(0xA7C2);
+INSERT INTO t1 VALUES(0xA7C3);
+INSERT INTO t1 VALUES(0xA7C4);
+INSERT INTO t1 VALUES(0xA7C5);
+INSERT INTO t1 VALUES(0xA7C6);
+INSERT INTO t1 VALUES(0xA7C7);
+INSERT INTO t1 VALUES(0xA7C8);
+INSERT INTO t1 VALUES(0xA7C9);
+INSERT INTO t1 VALUES(0xA7CA);
+INSERT INTO t1 VALUES(0xA7CB);
+INSERT INTO t1 VALUES(0xA7CC);
+INSERT INTO t1 VALUES(0xA7CD);
+INSERT INTO t1 VALUES(0xA7CE);
+INSERT INTO t1 VALUES(0xA7CF);
+INSERT INTO t1 VALUES(0xA7D0);
+INSERT INTO t1 VALUES(0xA7F2);
+INSERT INTO t1 VALUES(0xA7F3);
+INSERT INTO t1 VALUES(0xA7F4);
+INSERT INTO t1 VALUES(0xA7F5);
+INSERT INTO t1 VALUES(0xA7F6);
+INSERT INTO t1 VALUES(0xA7F7);
+INSERT INTO t1 VALUES(0xA7F8);
+INSERT INTO t1 VALUES(0xA7F9);
+INSERT INTO t1 VALUES(0xA7FA);
+INSERT INTO t1 VALUES(0xA7FB);
+INSERT INTO t1 VALUES(0xA7FC);
+INSERT INTO t1 VALUES(0xA7FD);
+INSERT INTO t1 VALUES(0xA7FE);
+INSERT INTO t1 VALUES(0xA8C1);
+INSERT INTO t1 VALUES(0xA8C2);
+INSERT INTO t1 VALUES(0xA8C3);
+INSERT INTO t1 VALUES(0xA8C4);
+INSERT INTO t1 VALUES(0xA8C5);
+INSERT INTO t1 VALUES(0xA8C6);
+INSERT INTO t1 VALUES(0xA8C7);
+INSERT INTO t1 VALUES(0xA8C8);
+INSERT INTO t1 VALUES(0xA8C9);
+INSERT INTO t1 VALUES(0xA8CA);
+INSERT INTO t1 VALUES(0xA8CB);
+INSERT INTO t1 VALUES(0xA8CC);
+INSERT INTO t1 VALUES(0xA8CD);
+INSERT INTO t1 VALUES(0xA8CE);
+INSERT INTO t1 VALUES(0xA8CF);
+INSERT INTO t1 VALUES(0xA8D0);
+INSERT INTO t1 VALUES(0xA8D1);
+INSERT INTO t1 VALUES(0xA8D2);
+INSERT INTO t1 VALUES(0xA8D3);
+INSERT INTO t1 VALUES(0xA8D4);
+INSERT INTO t1 VALUES(0xA8D5);
+INSERT INTO t1 VALUES(0xA8D6);
+INSERT INTO t1 VALUES(0xA8D7);
+INSERT INTO t1 VALUES(0xA8D8);
+INSERT INTO t1 VALUES(0xA8D9);
+INSERT INTO t1 VALUES(0xA8DA);
+INSERT INTO t1 VALUES(0xA8DB);
+INSERT INTO t1 VALUES(0xA8DC);
+INSERT INTO t1 VALUES(0xA8DD);
+INSERT INTO t1 VALUES(0xA8DE);
+INSERT INTO t1 VALUES(0xA8DF);
+INSERT INTO t1 VALUES(0xA8E0);
+INSERT INTO t1 VALUES(0xA8E1);
+INSERT INTO t1 VALUES(0xA8E2);
+INSERT INTO t1 VALUES(0xA8E3);
+INSERT INTO t1 VALUES(0xA8E4);
+INSERT INTO t1 VALUES(0xA8E5);
+INSERT INTO t1 VALUES(0xA8E6);
+INSERT INTO t1 VALUES(0xA8E7);
+INSERT INTO t1 VALUES(0xA8E8);
+INSERT INTO t1 VALUES(0xA8E9);
+INSERT INTO t1 VALUES(0xA8EA);
+INSERT INTO t1 VALUES(0xA8EB);
+INSERT INTO t1 VALUES(0xA8EC);
+INSERT INTO t1 VALUES(0xA8ED);
+INSERT INTO t1 VALUES(0xA8EE);
+INSERT INTO t1 VALUES(0xA8EF);
+INSERT INTO t1 VALUES(0xA8F0);
+INSERT INTO t1 VALUES(0xA8F1);
+INSERT INTO t1 VALUES(0xA8F2);
+INSERT INTO t1 VALUES(0xA8F3);
+INSERT INTO t1 VALUES(0xA8F4);
+INSERT INTO t1 VALUES(0xA8F5);
+INSERT INTO t1 VALUES(0xA8F6);
+INSERT INTO t1 VALUES(0xA8F7);
+INSERT INTO t1 VALUES(0xA8F8);
+INSERT INTO t1 VALUES(0xA8F9);
+INSERT INTO t1 VALUES(0xA8FA);
+INSERT INTO t1 VALUES(0xA8FB);
+INSERT INTO t1 VALUES(0xA8FC);
+INSERT INTO t1 VALUES(0xA8FD);
+INSERT INTO t1 VALUES(0xA8FE);
+INSERT INTO t1 VALUES(0xA9A1);
+INSERT INTO t1 VALUES(0xA9A2);
+INSERT INTO t1 VALUES(0xA9A3);
+INSERT INTO t1 VALUES(0xA9A4);
+INSERT INTO t1 VALUES(0xA9A5);
+INSERT INTO t1 VALUES(0xA9A6);
+INSERT INTO t1 VALUES(0xA9A7);
+INSERT INTO t1 VALUES(0xA9A8);
+INSERT INTO t1 VALUES(0xA9A9);
+INSERT INTO t1 VALUES(0xA9AA);
+INSERT INTO t1 VALUES(0xA9AB);
+INSERT INTO t1 VALUES(0xA9AC);
+INSERT INTO t1 VALUES(0xA9AD);
+INSERT INTO t1 VALUES(0xA9AE);
+INSERT INTO t1 VALUES(0xA9AF);
+INSERT INTO t1 VALUES(0xA9B0);
+INSERT INTO t1 VALUES(0xA9B1);
+INSERT INTO t1 VALUES(0xA9B2);
+INSERT INTO t1 VALUES(0xA9B3);
+INSERT INTO t1 VALUES(0xA9B4);
+INSERT INTO t1 VALUES(0xA9B5);
+INSERT INTO t1 VALUES(0xA9B6);
+INSERT INTO t1 VALUES(0xA9B7);
+INSERT INTO t1 VALUES(0xA9B8);
+INSERT INTO t1 VALUES(0xA9B9);
+INSERT INTO t1 VALUES(0xA9BA);
+INSERT INTO t1 VALUES(0xA9BB);
+INSERT INTO t1 VALUES(0xA9BC);
+INSERT INTO t1 VALUES(0xA9BD);
+INSERT INTO t1 VALUES(0xA9BE);
+INSERT INTO t1 VALUES(0xA9BF);
+INSERT INTO t1 VALUES(0xA9C0);
+INSERT INTO t1 VALUES(0xA9C1);
+INSERT INTO t1 VALUES(0xA9C2);
+INSERT INTO t1 VALUES(0xA9C3);
+INSERT INTO t1 VALUES(0xA9C4);
+INSERT INTO t1 VALUES(0xA9C5);
+INSERT INTO t1 VALUES(0xA9C6);
+INSERT INTO t1 VALUES(0xA9C7);
+INSERT INTO t1 VALUES(0xA9C8);
+INSERT INTO t1 VALUES(0xA9C9);
+INSERT INTO t1 VALUES(0xA9CA);
+INSERT INTO t1 VALUES(0xA9CB);
+INSERT INTO t1 VALUES(0xA9CC);
+INSERT INTO t1 VALUES(0xA9CD);
+INSERT INTO t1 VALUES(0xA9CE);
+INSERT INTO t1 VALUES(0xA9CF);
+INSERT INTO t1 VALUES(0xA9D0);
+INSERT INTO t1 VALUES(0xA9D1);
+INSERT INTO t1 VALUES(0xA9D2);
+INSERT INTO t1 VALUES(0xA9D3);
+INSERT INTO t1 VALUES(0xA9D4);
+INSERT INTO t1 VALUES(0xA9D5);
+INSERT INTO t1 VALUES(0xA9D6);
+INSERT INTO t1 VALUES(0xA9D7);
+INSERT INTO t1 VALUES(0xA9D8);
+INSERT INTO t1 VALUES(0xA9D9);
+INSERT INTO t1 VALUES(0xA9DA);
+INSERT INTO t1 VALUES(0xA9DB);
+INSERT INTO t1 VALUES(0xA9DC);
+INSERT INTO t1 VALUES(0xA9DD);
+INSERT INTO t1 VALUES(0xA9DE);
+INSERT INTO t1 VALUES(0xA9DF);
+INSERT INTO t1 VALUES(0xA9E0);
+INSERT INTO t1 VALUES(0xA9E1);
+INSERT INTO t1 VALUES(0xA9E2);
+INSERT INTO t1 VALUES(0xA9E3);
+INSERT INTO t1 VALUES(0xA9E4);
+INSERT INTO t1 VALUES(0xA9E5);
+INSERT INTO t1 VALUES(0xA9E6);
+INSERT INTO t1 VALUES(0xA9E7);
+INSERT INTO t1 VALUES(0xA9E8);
+INSERT INTO t1 VALUES(0xA9E9);
+INSERT INTO t1 VALUES(0xA9EA);
+INSERT INTO t1 VALUES(0xA9EB);
+INSERT INTO t1 VALUES(0xA9EC);
+INSERT INTO t1 VALUES(0xA9ED);
+INSERT INTO t1 VALUES(0xA9EE);
+INSERT INTO t1 VALUES(0xA9EF);
+INSERT INTO t1 VALUES(0xA9F0);
+INSERT INTO t1 VALUES(0xA9F1);
+INSERT INTO t1 VALUES(0xA9F2);
+INSERT INTO t1 VALUES(0xA9F3);
+INSERT INTO t1 VALUES(0xA9F4);
+INSERT INTO t1 VALUES(0xA9F5);
+INSERT INTO t1 VALUES(0xA9F6);
+INSERT INTO t1 VALUES(0xA9F7);
+INSERT INTO t1 VALUES(0xA9F8);
+INSERT INTO t1 VALUES(0xA9F9);
+INSERT INTO t1 VALUES(0xA9FA);
+INSERT INTO t1 VALUES(0xA9FB);
+INSERT INTO t1 VALUES(0xA9FC);
+INSERT INTO t1 VALUES(0xA9FD);
+INSERT INTO t1 VALUES(0xA9FE);
+INSERT INTO t1 VALUES(0xAAA1);
+INSERT INTO t1 VALUES(0xAAA2);
+INSERT INTO t1 VALUES(0xAAA3);
+INSERT INTO t1 VALUES(0xAAA4);
+INSERT INTO t1 VALUES(0xAAA5);
+INSERT INTO t1 VALUES(0xAAA6);
+INSERT INTO t1 VALUES(0xAAA7);
+INSERT INTO t1 VALUES(0xAAA8);
+INSERT INTO t1 VALUES(0xAAA9);
+INSERT INTO t1 VALUES(0xAAAA);
+INSERT INTO t1 VALUES(0xAAAB);
+INSERT INTO t1 VALUES(0xAAAC);
+INSERT INTO t1 VALUES(0xAAAD);
+INSERT INTO t1 VALUES(0xAAAE);
+INSERT INTO t1 VALUES(0xAAAF);
+INSERT INTO t1 VALUES(0xAAB0);
+INSERT INTO t1 VALUES(0xAAB1);
+INSERT INTO t1 VALUES(0xAAB2);
+INSERT INTO t1 VALUES(0xAAB3);
+INSERT INTO t1 VALUES(0xAAB4);
+INSERT INTO t1 VALUES(0xAAB5);
+INSERT INTO t1 VALUES(0xAAB6);
+INSERT INTO t1 VALUES(0xAAB7);
+INSERT INTO t1 VALUES(0xAAB8);
+INSERT INTO t1 VALUES(0xAAB9);
+INSERT INTO t1 VALUES(0xAABA);
+INSERT INTO t1 VALUES(0xAABB);
+INSERT INTO t1 VALUES(0xAABC);
+INSERT INTO t1 VALUES(0xAABD);
+INSERT INTO t1 VALUES(0xAABE);
+INSERT INTO t1 VALUES(0xAABF);
+INSERT INTO t1 VALUES(0xAAC0);
+INSERT INTO t1 VALUES(0xAAC1);
+INSERT INTO t1 VALUES(0xAAC2);
+INSERT INTO t1 VALUES(0xAAC3);
+INSERT INTO t1 VALUES(0xAAC4);
+INSERT INTO t1 VALUES(0xAAC5);
+INSERT INTO t1 VALUES(0xAAC6);
+INSERT INTO t1 VALUES(0xAAC7);
+INSERT INTO t1 VALUES(0xAAC8);
+INSERT INTO t1 VALUES(0xAAC9);
+INSERT INTO t1 VALUES(0xAACA);
+INSERT INTO t1 VALUES(0xAACB);
+INSERT INTO t1 VALUES(0xAACC);
+INSERT INTO t1 VALUES(0xAACD);
+INSERT INTO t1 VALUES(0xAACE);
+INSERT INTO t1 VALUES(0xAACF);
+INSERT INTO t1 VALUES(0xAAD0);
+INSERT INTO t1 VALUES(0xAAD1);
+INSERT INTO t1 VALUES(0xAAD2);
+INSERT INTO t1 VALUES(0xAAD3);
+INSERT INTO t1 VALUES(0xAAD4);
+INSERT INTO t1 VALUES(0xAAD5);
+INSERT INTO t1 VALUES(0xAAD6);
+INSERT INTO t1 VALUES(0xAAD7);
+INSERT INTO t1 VALUES(0xAAD8);
+INSERT INTO t1 VALUES(0xAAD9);
+INSERT INTO t1 VALUES(0xAADA);
+INSERT INTO t1 VALUES(0xAADB);
+INSERT INTO t1 VALUES(0xAADC);
+INSERT INTO t1 VALUES(0xAADD);
+INSERT INTO t1 VALUES(0xAADE);
+INSERT INTO t1 VALUES(0xAADF);
+INSERT INTO t1 VALUES(0xAAE0);
+INSERT INTO t1 VALUES(0xAAE1);
+INSERT INTO t1 VALUES(0xAAE2);
+INSERT INTO t1 VALUES(0xAAE3);
+INSERT INTO t1 VALUES(0xAAE4);
+INSERT INTO t1 VALUES(0xAAE5);
+INSERT INTO t1 VALUES(0xAAE6);
+INSERT INTO t1 VALUES(0xAAE7);
+INSERT INTO t1 VALUES(0xAAE8);
+INSERT INTO t1 VALUES(0xAAE9);
+INSERT INTO t1 VALUES(0xAAEA);
+INSERT INTO t1 VALUES(0xAAEB);
+INSERT INTO t1 VALUES(0xAAEC);
+INSERT INTO t1 VALUES(0xAAED);
+INSERT INTO t1 VALUES(0xAAEE);
+INSERT INTO t1 VALUES(0xAAEF);
+INSERT INTO t1 VALUES(0xAAF0);
+INSERT INTO t1 VALUES(0xAAF1);
+INSERT INTO t1 VALUES(0xAAF2);
+INSERT INTO t1 VALUES(0xAAF3);
+INSERT INTO t1 VALUES(0xAAF4);
+INSERT INTO t1 VALUES(0xAAF5);
+INSERT INTO t1 VALUES(0xAAF6);
+INSERT INTO t1 VALUES(0xAAF7);
+INSERT INTO t1 VALUES(0xAAF8);
+INSERT INTO t1 VALUES(0xAAF9);
+INSERT INTO t1 VALUES(0xAAFA);
+INSERT INTO t1 VALUES(0xAAFB);
+INSERT INTO t1 VALUES(0xAAFC);
+INSERT INTO t1 VALUES(0xAAFD);
+INSERT INTO t1 VALUES(0xAAFE);
+INSERT INTO t1 VALUES(0xABA1);
+INSERT INTO t1 VALUES(0xABA2);
+INSERT INTO t1 VALUES(0xABA3);
+INSERT INTO t1 VALUES(0xABA4);
+INSERT INTO t1 VALUES(0xABA5);
+INSERT INTO t1 VALUES(0xABA6);
+INSERT INTO t1 VALUES(0xABA7);
+INSERT INTO t1 VALUES(0xABA8);
+INSERT INTO t1 VALUES(0xABA9);
+INSERT INTO t1 VALUES(0xABAA);
+INSERT INTO t1 VALUES(0xABAB);
+INSERT INTO t1 VALUES(0xABAC);
+INSERT INTO t1 VALUES(0xABAD);
+INSERT INTO t1 VALUES(0xABAE);
+INSERT INTO t1 VALUES(0xABAF);
+INSERT INTO t1 VALUES(0xABB0);
+INSERT INTO t1 VALUES(0xABB1);
+INSERT INTO t1 VALUES(0xABB2);
+INSERT INTO t1 VALUES(0xABB3);
+INSERT INTO t1 VALUES(0xABB4);
+INSERT INTO t1 VALUES(0xABB5);
+INSERT INTO t1 VALUES(0xABB6);
+INSERT INTO t1 VALUES(0xABB7);
+INSERT INTO t1 VALUES(0xABB8);
+INSERT INTO t1 VALUES(0xABB9);
+INSERT INTO t1 VALUES(0xABBA);
+INSERT INTO t1 VALUES(0xABBB);
+INSERT INTO t1 VALUES(0xABBC);
+INSERT INTO t1 VALUES(0xABBD);
+INSERT INTO t1 VALUES(0xABBE);
+INSERT INTO t1 VALUES(0xABBF);
+INSERT INTO t1 VALUES(0xABC0);
+INSERT INTO t1 VALUES(0xABC1);
+INSERT INTO t1 VALUES(0xABC2);
+INSERT INTO t1 VALUES(0xABC3);
+INSERT INTO t1 VALUES(0xABC4);
+INSERT INTO t1 VALUES(0xABC5);
+INSERT INTO t1 VALUES(0xABC6);
+INSERT INTO t1 VALUES(0xABC7);
+INSERT INTO t1 VALUES(0xABC8);
+INSERT INTO t1 VALUES(0xABC9);
+INSERT INTO t1 VALUES(0xABCA);
+INSERT INTO t1 VALUES(0xABCB);
+INSERT INTO t1 VALUES(0xABCC);
+INSERT INTO t1 VALUES(0xABCD);
+INSERT INTO t1 VALUES(0xABCE);
+INSERT INTO t1 VALUES(0xABCF);
+INSERT INTO t1 VALUES(0xABD0);
+INSERT INTO t1 VALUES(0xABD1);
+INSERT INTO t1 VALUES(0xABD2);
+INSERT INTO t1 VALUES(0xABD3);
+INSERT INTO t1 VALUES(0xABD4);
+INSERT INTO t1 VALUES(0xABD5);
+INSERT INTO t1 VALUES(0xABD6);
+INSERT INTO t1 VALUES(0xABD7);
+INSERT INTO t1 VALUES(0xABD8);
+INSERT INTO t1 VALUES(0xABD9);
+INSERT INTO t1 VALUES(0xABDA);
+INSERT INTO t1 VALUES(0xABDB);
+INSERT INTO t1 VALUES(0xABDC);
+INSERT INTO t1 VALUES(0xABDD);
+INSERT INTO t1 VALUES(0xABDE);
+INSERT INTO t1 VALUES(0xABDF);
+INSERT INTO t1 VALUES(0xABE0);
+INSERT INTO t1 VALUES(0xABE1);
+INSERT INTO t1 VALUES(0xABE2);
+INSERT INTO t1 VALUES(0xABE3);
+INSERT INTO t1 VALUES(0xABE4);
+INSERT INTO t1 VALUES(0xABE5);
+INSERT INTO t1 VALUES(0xABE6);
+INSERT INTO t1 VALUES(0xABE7);
+INSERT INTO t1 VALUES(0xABE8);
+INSERT INTO t1 VALUES(0xABE9);
+INSERT INTO t1 VALUES(0xABEA);
+INSERT INTO t1 VALUES(0xABEB);
+INSERT INTO t1 VALUES(0xABEC);
+INSERT INTO t1 VALUES(0xABED);
+INSERT INTO t1 VALUES(0xABEE);
+INSERT INTO t1 VALUES(0xABEF);
+INSERT INTO t1 VALUES(0xABF0);
+INSERT INTO t1 VALUES(0xABF1);
+INSERT INTO t1 VALUES(0xABF2);
+INSERT INTO t1 VALUES(0xABF3);
+INSERT INTO t1 VALUES(0xABF4);
+INSERT INTO t1 VALUES(0xABF5);
+INSERT INTO t1 VALUES(0xABF6);
+INSERT INTO t1 VALUES(0xABF7);
+INSERT INTO t1 VALUES(0xABF8);
+INSERT INTO t1 VALUES(0xABF9);
+INSERT INTO t1 VALUES(0xABFA);
+INSERT INTO t1 VALUES(0xABFB);
+INSERT INTO t1 VALUES(0xABFC);
+INSERT INTO t1 VALUES(0xABFD);
+INSERT INTO t1 VALUES(0xABFE);
+INSERT INTO t1 VALUES(0xACA1);
+INSERT INTO t1 VALUES(0xACA2);
+INSERT INTO t1 VALUES(0xACA3);
+INSERT INTO t1 VALUES(0xACA4);
+INSERT INTO t1 VALUES(0xACA5);
+INSERT INTO t1 VALUES(0xACA6);
+INSERT INTO t1 VALUES(0xACA7);
+INSERT INTO t1 VALUES(0xACA8);
+INSERT INTO t1 VALUES(0xACA9);
+INSERT INTO t1 VALUES(0xACAA);
+INSERT INTO t1 VALUES(0xACAB);
+INSERT INTO t1 VALUES(0xACAC);
+INSERT INTO t1 VALUES(0xACAD);
+INSERT INTO t1 VALUES(0xACAE);
+INSERT INTO t1 VALUES(0xACAF);
+INSERT INTO t1 VALUES(0xACB0);
+INSERT INTO t1 VALUES(0xACB1);
+INSERT INTO t1 VALUES(0xACB2);
+INSERT INTO t1 VALUES(0xACB3);
+INSERT INTO t1 VALUES(0xACB4);
+INSERT INTO t1 VALUES(0xACB5);
+INSERT INTO t1 VALUES(0xACB6);
+INSERT INTO t1 VALUES(0xACB7);
+INSERT INTO t1 VALUES(0xACB8);
+INSERT INTO t1 VALUES(0xACB9);
+INSERT INTO t1 VALUES(0xACBA);
+INSERT INTO t1 VALUES(0xACBB);
+INSERT INTO t1 VALUES(0xACBC);
+INSERT INTO t1 VALUES(0xACBD);
+INSERT INTO t1 VALUES(0xACBE);
+INSERT INTO t1 VALUES(0xACBF);
+INSERT INTO t1 VALUES(0xACC0);
+INSERT INTO t1 VALUES(0xACC1);
+INSERT INTO t1 VALUES(0xACC2);
+INSERT INTO t1 VALUES(0xACC3);
+INSERT INTO t1 VALUES(0xACC4);
+INSERT INTO t1 VALUES(0xACC5);
+INSERT INTO t1 VALUES(0xACC6);
+INSERT INTO t1 VALUES(0xACC7);
+INSERT INTO t1 VALUES(0xACC8);
+INSERT INTO t1 VALUES(0xACC9);
+INSERT INTO t1 VALUES(0xACCA);
+INSERT INTO t1 VALUES(0xACCB);
+INSERT INTO t1 VALUES(0xACCC);
+INSERT INTO t1 VALUES(0xACCD);
+INSERT INTO t1 VALUES(0xACCE);
+INSERT INTO t1 VALUES(0xACCF);
+INSERT INTO t1 VALUES(0xACD0);
+INSERT INTO t1 VALUES(0xACD1);
+INSERT INTO t1 VALUES(0xACD2);
+INSERT INTO t1 VALUES(0xACD3);
+INSERT INTO t1 VALUES(0xACD4);
+INSERT INTO t1 VALUES(0xACD5);
+INSERT INTO t1 VALUES(0xACD6);
+INSERT INTO t1 VALUES(0xACD7);
+INSERT INTO t1 VALUES(0xACD8);
+INSERT INTO t1 VALUES(0xACD9);
+INSERT INTO t1 VALUES(0xACDA);
+INSERT INTO t1 VALUES(0xACDB);
+INSERT INTO t1 VALUES(0xACDC);
+INSERT INTO t1 VALUES(0xACDD);
+INSERT INTO t1 VALUES(0xACDE);
+INSERT INTO t1 VALUES(0xACDF);
+INSERT INTO t1 VALUES(0xACE0);
+INSERT INTO t1 VALUES(0xACE1);
+INSERT INTO t1 VALUES(0xACE2);
+INSERT INTO t1 VALUES(0xACE3);
+INSERT INTO t1 VALUES(0xACE4);
+INSERT INTO t1 VALUES(0xACE5);
+INSERT INTO t1 VALUES(0xACE6);
+INSERT INTO t1 VALUES(0xACE7);
+INSERT INTO t1 VALUES(0xACE8);
+INSERT INTO t1 VALUES(0xACE9);
+INSERT INTO t1 VALUES(0xACEA);
+INSERT INTO t1 VALUES(0xACEB);
+INSERT INTO t1 VALUES(0xACEC);
+INSERT INTO t1 VALUES(0xACED);
+INSERT INTO t1 VALUES(0xACEE);
+INSERT INTO t1 VALUES(0xACEF);
+INSERT INTO t1 VALUES(0xACF0);
+INSERT INTO t1 VALUES(0xACF1);
+INSERT INTO t1 VALUES(0xACF2);
+INSERT INTO t1 VALUES(0xACF3);
+INSERT INTO t1 VALUES(0xACF4);
+INSERT INTO t1 VALUES(0xACF5);
+INSERT INTO t1 VALUES(0xACF6);
+INSERT INTO t1 VALUES(0xACF7);
+INSERT INTO t1 VALUES(0xACF8);
+INSERT INTO t1 VALUES(0xACF9);
+INSERT INTO t1 VALUES(0xACFA);
+INSERT INTO t1 VALUES(0xACFB);
+INSERT INTO t1 VALUES(0xACFC);
+INSERT INTO t1 VALUES(0xACFD);
+INSERT INTO t1 VALUES(0xACFE);
+INSERT INTO t1 VALUES(0xADA1);
+INSERT INTO t1 VALUES(0xADA2);
+INSERT INTO t1 VALUES(0xADA3);
+INSERT INTO t1 VALUES(0xADA4);
+INSERT INTO t1 VALUES(0xADA5);
+INSERT INTO t1 VALUES(0xADA6);
+INSERT INTO t1 VALUES(0xADA7);
+INSERT INTO t1 VALUES(0xADA8);
+INSERT INTO t1 VALUES(0xADA9);
+INSERT INTO t1 VALUES(0xADAA);
+INSERT INTO t1 VALUES(0xADAB);
+INSERT INTO t1 VALUES(0xADAC);
+INSERT INTO t1 VALUES(0xADAD);
+INSERT INTO t1 VALUES(0xADAE);
+INSERT INTO t1 VALUES(0xADAF);
+INSERT INTO t1 VALUES(0xADB0);
+INSERT INTO t1 VALUES(0xADB1);
+INSERT INTO t1 VALUES(0xADB2);
+INSERT INTO t1 VALUES(0xADB3);
+INSERT INTO t1 VALUES(0xADB4);
+INSERT INTO t1 VALUES(0xADB5);
+INSERT INTO t1 VALUES(0xADB6);
+INSERT INTO t1 VALUES(0xADB7);
+INSERT INTO t1 VALUES(0xADB8);
+INSERT INTO t1 VALUES(0xADB9);
+INSERT INTO t1 VALUES(0xADBA);
+INSERT INTO t1 VALUES(0xADBB);
+INSERT INTO t1 VALUES(0xADBC);
+INSERT INTO t1 VALUES(0xADBD);
+INSERT INTO t1 VALUES(0xADBE);
+INSERT INTO t1 VALUES(0xADBF);
+INSERT INTO t1 VALUES(0xADC0);
+INSERT INTO t1 VALUES(0xADC1);
+INSERT INTO t1 VALUES(0xADC2);
+INSERT INTO t1 VALUES(0xADC3);
+INSERT INTO t1 VALUES(0xADC4);
+INSERT INTO t1 VALUES(0xADC5);
+INSERT INTO t1 VALUES(0xADC6);
+INSERT INTO t1 VALUES(0xADC7);
+INSERT INTO t1 VALUES(0xADC8);
+INSERT INTO t1 VALUES(0xADC9);
+INSERT INTO t1 VALUES(0xADCA);
+INSERT INTO t1 VALUES(0xADCB);
+INSERT INTO t1 VALUES(0xADCC);
+INSERT INTO t1 VALUES(0xADCD);
+INSERT INTO t1 VALUES(0xADCE);
+INSERT INTO t1 VALUES(0xADCF);
+INSERT INTO t1 VALUES(0xADD0);
+INSERT INTO t1 VALUES(0xADD1);
+INSERT INTO t1 VALUES(0xADD2);
+INSERT INTO t1 VALUES(0xADD3);
+INSERT INTO t1 VALUES(0xADD4);
+INSERT INTO t1 VALUES(0xADD5);
+INSERT INTO t1 VALUES(0xADD6);
+INSERT INTO t1 VALUES(0xADD7);
+INSERT INTO t1 VALUES(0xADD8);
+INSERT INTO t1 VALUES(0xADD9);
+INSERT INTO t1 VALUES(0xADDA);
+INSERT INTO t1 VALUES(0xADDB);
+INSERT INTO t1 VALUES(0xADDC);
+INSERT INTO t1 VALUES(0xADDD);
+INSERT INTO t1 VALUES(0xADDE);
+INSERT INTO t1 VALUES(0xADDF);
+INSERT INTO t1 VALUES(0xADE0);
+INSERT INTO t1 VALUES(0xADE1);
+INSERT INTO t1 VALUES(0xADE2);
+INSERT INTO t1 VALUES(0xADE3);
+INSERT INTO t1 VALUES(0xADE4);
+INSERT INTO t1 VALUES(0xADE5);
+INSERT INTO t1 VALUES(0xADE6);
+INSERT INTO t1 VALUES(0xADE7);
+INSERT INTO t1 VALUES(0xADE8);
+INSERT INTO t1 VALUES(0xADE9);
+INSERT INTO t1 VALUES(0xADEA);
+INSERT INTO t1 VALUES(0xADEB);
+INSERT INTO t1 VALUES(0xADEC);
+INSERT INTO t1 VALUES(0xADED);
+INSERT INTO t1 VALUES(0xADEE);
+INSERT INTO t1 VALUES(0xADEF);
+INSERT INTO t1 VALUES(0xADF0);
+INSERT INTO t1 VALUES(0xADF1);
+INSERT INTO t1 VALUES(0xADF2);
+INSERT INTO t1 VALUES(0xADF3);
+INSERT INTO t1 VALUES(0xADF4);
+INSERT INTO t1 VALUES(0xADF5);
+INSERT INTO t1 VALUES(0xADF6);
+INSERT INTO t1 VALUES(0xADF7);
+INSERT INTO t1 VALUES(0xADF8);
+INSERT INTO t1 VALUES(0xADF9);
+INSERT INTO t1 VALUES(0xADFA);
+INSERT INTO t1 VALUES(0xADFB);
+INSERT INTO t1 VALUES(0xADFC);
+INSERT INTO t1 VALUES(0xADFD);
+INSERT INTO t1 VALUES(0xADFE);
+INSERT INTO t1 VALUES(0xAEA1);
+INSERT INTO t1 VALUES(0xAEA2);
+INSERT INTO t1 VALUES(0xAEA3);
+INSERT INTO t1 VALUES(0xAEA4);
+INSERT INTO t1 VALUES(0xAEA5);
+INSERT INTO t1 VALUES(0xAEA6);
+INSERT INTO t1 VALUES(0xAEA7);
+INSERT INTO t1 VALUES(0xAEA8);
+INSERT INTO t1 VALUES(0xAEA9);
+INSERT INTO t1 VALUES(0xAEAA);
+INSERT INTO t1 VALUES(0xAEAB);
+INSERT INTO t1 VALUES(0xAEAC);
+INSERT INTO t1 VALUES(0xAEAD);
+INSERT INTO t1 VALUES(0xAEAE);
+INSERT INTO t1 VALUES(0xAEAF);
+INSERT INTO t1 VALUES(0xAEB0);
+INSERT INTO t1 VALUES(0xAEB1);
+INSERT INTO t1 VALUES(0xAEB2);
+INSERT INTO t1 VALUES(0xAEB3);
+INSERT INTO t1 VALUES(0xAEB4);
+INSERT INTO t1 VALUES(0xAEB5);
+INSERT INTO t1 VALUES(0xAEB6);
+INSERT INTO t1 VALUES(0xAEB7);
+INSERT INTO t1 VALUES(0xAEB8);
+INSERT INTO t1 VALUES(0xAEB9);
+INSERT INTO t1 VALUES(0xAEBA);
+INSERT INTO t1 VALUES(0xAEBB);
+INSERT INTO t1 VALUES(0xAEBC);
+INSERT INTO t1 VALUES(0xAEBD);
+INSERT INTO t1 VALUES(0xAEBE);
+INSERT INTO t1 VALUES(0xAEBF);
+INSERT INTO t1 VALUES(0xAEC0);
+INSERT INTO t1 VALUES(0xAEC1);
+INSERT INTO t1 VALUES(0xAEC2);
+INSERT INTO t1 VALUES(0xAEC3);
+INSERT INTO t1 VALUES(0xAEC4);
+INSERT INTO t1 VALUES(0xAEC5);
+INSERT INTO t1 VALUES(0xAEC6);
+INSERT INTO t1 VALUES(0xAEC7);
+INSERT INTO t1 VALUES(0xAEC8);
+INSERT INTO t1 VALUES(0xAEC9);
+INSERT INTO t1 VALUES(0xAECA);
+INSERT INTO t1 VALUES(0xAECB);
+INSERT INTO t1 VALUES(0xAECC);
+INSERT INTO t1 VALUES(0xAECD);
+INSERT INTO t1 VALUES(0xAECE);
+INSERT INTO t1 VALUES(0xAECF);
+INSERT INTO t1 VALUES(0xAED0);
+INSERT INTO t1 VALUES(0xAED1);
+INSERT INTO t1 VALUES(0xAED2);
+INSERT INTO t1 VALUES(0xAED3);
+INSERT INTO t1 VALUES(0xAED4);
+INSERT INTO t1 VALUES(0xAED5);
+INSERT INTO t1 VALUES(0xAED6);
+INSERT INTO t1 VALUES(0xAED7);
+INSERT INTO t1 VALUES(0xAED8);
+INSERT INTO t1 VALUES(0xAED9);
+INSERT INTO t1 VALUES(0xAEDA);
+INSERT INTO t1 VALUES(0xAEDB);
+INSERT INTO t1 VALUES(0xAEDC);
+INSERT INTO t1 VALUES(0xAEDD);
+INSERT INTO t1 VALUES(0xAEDE);
+INSERT INTO t1 VALUES(0xAEDF);
+INSERT INTO t1 VALUES(0xAEE0);
+INSERT INTO t1 VALUES(0xAEE1);
+INSERT INTO t1 VALUES(0xAEE2);
+INSERT INTO t1 VALUES(0xAEE3);
+INSERT INTO t1 VALUES(0xAEE4);
+INSERT INTO t1 VALUES(0xAEE5);
+INSERT INTO t1 VALUES(0xAEE6);
+INSERT INTO t1 VALUES(0xAEE7);
+INSERT INTO t1 VALUES(0xAEE8);
+INSERT INTO t1 VALUES(0xAEE9);
+INSERT INTO t1 VALUES(0xAEEA);
+INSERT INTO t1 VALUES(0xAEEB);
+INSERT INTO t1 VALUES(0xAEEC);
+INSERT INTO t1 VALUES(0xAEED);
+INSERT INTO t1 VALUES(0xAEEE);
+INSERT INTO t1 VALUES(0xAEEF);
+INSERT INTO t1 VALUES(0xAEF0);
+INSERT INTO t1 VALUES(0xAEF1);
+INSERT INTO t1 VALUES(0xAEF2);
+INSERT INTO t1 VALUES(0xAEF3);
+INSERT INTO t1 VALUES(0xAEF4);
+INSERT INTO t1 VALUES(0xAEF5);
+INSERT INTO t1 VALUES(0xAEF6);
+INSERT INTO t1 VALUES(0xAEF7);
+INSERT INTO t1 VALUES(0xAEF8);
+INSERT INTO t1 VALUES(0xAEF9);
+INSERT INTO t1 VALUES(0xAEFA);
+INSERT INTO t1 VALUES(0xAEFB);
+INSERT INTO t1 VALUES(0xAEFC);
+INSERT INTO t1 VALUES(0xAEFD);
+INSERT INTO t1 VALUES(0xAEFE);
+INSERT INTO t1 VALUES(0xAFA1);
+INSERT INTO t1 VALUES(0xAFA2);
+INSERT INTO t1 VALUES(0xAFA3);
+INSERT INTO t1 VALUES(0xAFA4);
+INSERT INTO t1 VALUES(0xAFA5);
+INSERT INTO t1 VALUES(0xAFA6);
+INSERT INTO t1 VALUES(0xAFA7);
+INSERT INTO t1 VALUES(0xAFA8);
+INSERT INTO t1 VALUES(0xAFA9);
+INSERT INTO t1 VALUES(0xAFAA);
+INSERT INTO t1 VALUES(0xAFAB);
+INSERT INTO t1 VALUES(0xAFAC);
+INSERT INTO t1 VALUES(0xAFAD);
+INSERT INTO t1 VALUES(0xAFAE);
+INSERT INTO t1 VALUES(0xAFAF);
+INSERT INTO t1 VALUES(0xAFB0);
+INSERT INTO t1 VALUES(0xAFB1);
+INSERT INTO t1 VALUES(0xAFB2);
+INSERT INTO t1 VALUES(0xAFB3);
+INSERT INTO t1 VALUES(0xAFB4);
+INSERT INTO t1 VALUES(0xAFB5);
+INSERT INTO t1 VALUES(0xAFB6);
+INSERT INTO t1 VALUES(0xAFB7);
+INSERT INTO t1 VALUES(0xAFB8);
+INSERT INTO t1 VALUES(0xAFB9);
+INSERT INTO t1 VALUES(0xAFBA);
+INSERT INTO t1 VALUES(0xAFBB);
+INSERT INTO t1 VALUES(0xAFBC);
+INSERT INTO t1 VALUES(0xAFBD);
+INSERT INTO t1 VALUES(0xAFBE);
+INSERT INTO t1 VALUES(0xAFBF);
+INSERT INTO t1 VALUES(0xAFC0);
+INSERT INTO t1 VALUES(0xAFC1);
+INSERT INTO t1 VALUES(0xAFC2);
+INSERT INTO t1 VALUES(0xAFC3);
+INSERT INTO t1 VALUES(0xAFC4);
+INSERT INTO t1 VALUES(0xAFC5);
+INSERT INTO t1 VALUES(0xAFC6);
+INSERT INTO t1 VALUES(0xAFC7);
+INSERT INTO t1 VALUES(0xAFC8);
+INSERT INTO t1 VALUES(0xAFC9);
+INSERT INTO t1 VALUES(0xAFCA);
+INSERT INTO t1 VALUES(0xAFCB);
+INSERT INTO t1 VALUES(0xAFCC);
+INSERT INTO t1 VALUES(0xAFCD);
+INSERT INTO t1 VALUES(0xAFCE);
+INSERT INTO t1 VALUES(0xAFCF);
+INSERT INTO t1 VALUES(0xAFD0);
+INSERT INTO t1 VALUES(0xAFD1);
+INSERT INTO t1 VALUES(0xAFD2);
+INSERT INTO t1 VALUES(0xAFD3);
+INSERT INTO t1 VALUES(0xAFD4);
+INSERT INTO t1 VALUES(0xAFD5);
+INSERT INTO t1 VALUES(0xAFD6);
+INSERT INTO t1 VALUES(0xAFD7);
+INSERT INTO t1 VALUES(0xAFD8);
+INSERT INTO t1 VALUES(0xAFD9);
+INSERT INTO t1 VALUES(0xAFDA);
+INSERT INTO t1 VALUES(0xAFDB);
+INSERT INTO t1 VALUES(0xAFDC);
+INSERT INTO t1 VALUES(0xAFDD);
+INSERT INTO t1 VALUES(0xAFDE);
+INSERT INTO t1 VALUES(0xAFDF);
+INSERT INTO t1 VALUES(0xAFE0);
+INSERT INTO t1 VALUES(0xAFE1);
+INSERT INTO t1 VALUES(0xAFE2);
+INSERT INTO t1 VALUES(0xAFE3);
+INSERT INTO t1 VALUES(0xAFE4);
+INSERT INTO t1 VALUES(0xAFE5);
+INSERT INTO t1 VALUES(0xAFE6);
+INSERT INTO t1 VALUES(0xAFE7);
+INSERT INTO t1 VALUES(0xAFE8);
+INSERT INTO t1 VALUES(0xAFE9);
+INSERT INTO t1 VALUES(0xAFEA);
+INSERT INTO t1 VALUES(0xAFEB);
+INSERT INTO t1 VALUES(0xAFEC);
+INSERT INTO t1 VALUES(0xAFED);
+INSERT INTO t1 VALUES(0xAFEE);
+INSERT INTO t1 VALUES(0xAFEF);
+INSERT INTO t1 VALUES(0xAFF0);
+INSERT INTO t1 VALUES(0xAFF1);
+INSERT INTO t1 VALUES(0xAFF2);
+INSERT INTO t1 VALUES(0xAFF3);
+INSERT INTO t1 VALUES(0xAFF4);
+INSERT INTO t1 VALUES(0xAFF5);
+INSERT INTO t1 VALUES(0xAFF6);
+INSERT INTO t1 VALUES(0xAFF7);
+INSERT INTO t1 VALUES(0xAFF8);
+INSERT INTO t1 VALUES(0xAFF9);
+INSERT INTO t1 VALUES(0xAFFA);
+INSERT INTO t1 VALUES(0xAFFB);
+INSERT INTO t1 VALUES(0xAFFC);
+INSERT INTO t1 VALUES(0xAFFD);
+INSERT INTO t1 VALUES(0xAFFE);
+INSERT INTO t1 VALUES(0xCFD4);
+INSERT INTO t1 VALUES(0xCFD5);
+INSERT INTO t1 VALUES(0xCFD6);
+INSERT INTO t1 VALUES(0xCFD7);
+INSERT INTO t1 VALUES(0xCFD8);
+INSERT INTO t1 VALUES(0xCFD9);
+INSERT INTO t1 VALUES(0xCFDA);
+INSERT INTO t1 VALUES(0xCFDB);
+INSERT INTO t1 VALUES(0xCFDC);
+INSERT INTO t1 VALUES(0xCFDD);
+INSERT INTO t1 VALUES(0xCFDE);
+INSERT INTO t1 VALUES(0xCFDF);
+INSERT INTO t1 VALUES(0xCFE0);
+INSERT INTO t1 VALUES(0xCFE1);
+INSERT INTO t1 VALUES(0xCFE2);
+INSERT INTO t1 VALUES(0xCFE3);
+INSERT INTO t1 VALUES(0xCFE4);
+INSERT INTO t1 VALUES(0xCFE5);
+INSERT INTO t1 VALUES(0xCFE6);
+INSERT INTO t1 VALUES(0xCFE7);
+INSERT INTO t1 VALUES(0xCFE8);
+INSERT INTO t1 VALUES(0xCFE9);
+INSERT INTO t1 VALUES(0xCFEA);
+INSERT INTO t1 VALUES(0xCFEB);
+INSERT INTO t1 VALUES(0xCFEC);
+INSERT INTO t1 VALUES(0xCFED);
+INSERT INTO t1 VALUES(0xCFEE);
+INSERT INTO t1 VALUES(0xCFEF);
+INSERT INTO t1 VALUES(0xCFF0);
+INSERT INTO t1 VALUES(0xCFF1);
+INSERT INTO t1 VALUES(0xCFF2);
+INSERT INTO t1 VALUES(0xCFF3);
+INSERT INTO t1 VALUES(0xCFF4);
+INSERT INTO t1 VALUES(0xCFF5);
+INSERT INTO t1 VALUES(0xCFF6);
+INSERT INTO t1 VALUES(0xCFF7);
+INSERT INTO t1 VALUES(0xCFF8);
+INSERT INTO t1 VALUES(0xCFF9);
+INSERT INTO t1 VALUES(0xCFFA);
+INSERT INTO t1 VALUES(0xCFFB);
+INSERT INTO t1 VALUES(0xCFFC);
+INSERT INTO t1 VALUES(0xCFFD);
+INSERT INTO t1 VALUES(0xCFFE);
+INSERT INTO t1 VALUES(0xF4A7);
+INSERT INTO t1 VALUES(0xF4A8);
+INSERT INTO t1 VALUES(0xF4A9);
+INSERT INTO t1 VALUES(0xF4AA);
+INSERT INTO t1 VALUES(0xF4AB);
+INSERT INTO t1 VALUES(0xF4AC);
+INSERT INTO t1 VALUES(0xF4AD);
+INSERT INTO t1 VALUES(0xF4AE);
+INSERT INTO t1 VALUES(0xF4AF);
+INSERT INTO t1 VALUES(0xF4B0);
+INSERT INTO t1 VALUES(0xF4B1);
+INSERT INTO t1 VALUES(0xF4B2);
+INSERT INTO t1 VALUES(0xF4B3);
+INSERT INTO t1 VALUES(0xF4B4);
+INSERT INTO t1 VALUES(0xF4B5);
+INSERT INTO t1 VALUES(0xF4B6);
+INSERT INTO t1 VALUES(0xF4B7);
+INSERT INTO t1 VALUES(0xF4B8);
+INSERT INTO t1 VALUES(0xF4B9);
+INSERT INTO t1 VALUES(0xF4BA);
+INSERT INTO t1 VALUES(0xF4BB);
+INSERT INTO t1 VALUES(0xF4BC);
+INSERT INTO t1 VALUES(0xF4BD);
+INSERT INTO t1 VALUES(0xF4BE);
+INSERT INTO t1 VALUES(0xF4BF);
+INSERT INTO t1 VALUES(0xF4C0);
+INSERT INTO t1 VALUES(0xF4C1);
+INSERT INTO t1 VALUES(0xF4C2);
+INSERT INTO t1 VALUES(0xF4C3);
+INSERT INTO t1 VALUES(0xF4C4);
+INSERT INTO t1 VALUES(0xF4C5);
+INSERT INTO t1 VALUES(0xF4C6);
+INSERT INTO t1 VALUES(0xF4C7);
+INSERT INTO t1 VALUES(0xF4C8);
+INSERT INTO t1 VALUES(0xF4C9);
+INSERT INTO t1 VALUES(0xF4CA);
+INSERT INTO t1 VALUES(0xF4CB);
+INSERT INTO t1 VALUES(0xF4CC);
+INSERT INTO t1 VALUES(0xF4CD);
+INSERT INTO t1 VALUES(0xF4CE);
+INSERT INTO t1 VALUES(0xF4CF);
+INSERT INTO t1 VALUES(0xF4D0);
+INSERT INTO t1 VALUES(0xF4D1);
+INSERT INTO t1 VALUES(0xF4D2);
+INSERT INTO t1 VALUES(0xF4D3);
+INSERT INTO t1 VALUES(0xF4D4);
+INSERT INTO t1 VALUES(0xF4D5);
+INSERT INTO t1 VALUES(0xF4D6);
+INSERT INTO t1 VALUES(0xF4D7);
+INSERT INTO t1 VALUES(0xF4D8);
+INSERT INTO t1 VALUES(0xF4D9);
+INSERT INTO t1 VALUES(0xF4DA);
+INSERT INTO t1 VALUES(0xF4DB);
+INSERT INTO t1 VALUES(0xF4DC);
+INSERT INTO t1 VALUES(0xF4DD);
+INSERT INTO t1 VALUES(0xF4DE);
+INSERT INTO t1 VALUES(0xF4DF);
+INSERT INTO t1 VALUES(0xF4E0);
+INSERT INTO t1 VALUES(0xF4E1);
+INSERT INTO t1 VALUES(0xF4E2);
+INSERT INTO t1 VALUES(0xF4E3);
+INSERT INTO t1 VALUES(0xF4E4);
+INSERT INTO t1 VALUES(0xF4E5);
+INSERT INTO t1 VALUES(0xF4E6);
+INSERT INTO t1 VALUES(0xF4E7);
+INSERT INTO t1 VALUES(0xF4E8);
+INSERT INTO t1 VALUES(0xF4E9);
+INSERT INTO t1 VALUES(0xF4EA);
+INSERT INTO t1 VALUES(0xF4EB);
+INSERT INTO t1 VALUES(0xF4EC);
+INSERT INTO t1 VALUES(0xF4ED);
+INSERT INTO t1 VALUES(0xF4EE);
+INSERT INTO t1 VALUES(0xF4EF);
+INSERT INTO t1 VALUES(0xF4F0);
+INSERT INTO t1 VALUES(0xF4F1);
+INSERT INTO t1 VALUES(0xF4F2);
+INSERT INTO t1 VALUES(0xF4F3);
+INSERT INTO t1 VALUES(0xF4F4);
+INSERT INTO t1 VALUES(0xF4F5);
+INSERT INTO t1 VALUES(0xF4F6);
+INSERT INTO t1 VALUES(0xF4F7);
+INSERT INTO t1 VALUES(0xF4F8);
+INSERT INTO t1 VALUES(0xF4F9);
+INSERT INTO t1 VALUES(0xF4FA);
+INSERT INTO t1 VALUES(0xF4FB);
+INSERT INTO t1 VALUES(0xF4FC);
+INSERT INTO t1 VALUES(0xF4FD);
+INSERT INTO t1 VALUES(0xF4FE);
+SELECT HEX(c) FROM t1 ORDER BY BINARY c;
+HEX(c)
+A2AF
+A2B0
+A2B1
+A2B2
+A2B3
+A2B4
+A2B5
+A2B6
+A2B7
+A2B8
+A2B9
+A2C2
+A2C3
+A2C4
+A2C5
+A2C6
+A2C7
+A2C8
+A2C9
+A2D1
+A2D2
+A2D3
+A2D4
+A2D5
+A2D6
+A2D7
+A2D8
+A2D9
+A2DA
+A2DB
+A2EB
+A2EC
+A2ED
+A2EE
+A2EF
+A2F0
+A2F1
+A2FA
+A2FB
+A2FC
+A2FD
+A3A1
+A3A2
+A3A3
+A3A4
+A3A5
+A3A6
+A3A7
+A3A8
+A3A9
+A3AA
+A3AB
+A3AC
+A3AD
+A3AE
+A3AF
+A3BA
+A3BB
+A3BC
+A3BD
+A3BE
+A3BF
+A3C0
+A3DB
+A3DC
+A3DD
+A3DE
+A3DF
+A3E0
+A3FB
+A3FC
+A3FD
+A3FE
+A4F4
+A4F5
+A4F6
+A4F7
+A4F8
+A4F9
+A4FA
+A4FB
+A4FC
+A4FD
+A4FE
+A5F7
+A5F8
+A5F9
+A5FA
+A5FB
+A5FC
+A5FD
+A5FE
+A6B9
+A6BA
+A6BB
+A6BC
+A6BD
+A6BE
+A6BF
+A6C0
+A6D9
+A6DA
+A6DB
+A6DC
+A6DD
+A6DE
+A6DF
+A6E0
+A6E1
+A6E2
+A6E3
+A6E4
+A6E5
+A6E6
+A6E7
+A6E8
+A6E9
+A6EA
+A6EB
+A6EC
+A6ED
+A6EE
+A6EF
+A6F0
+A6F1
+A6F2
+A6F3
+A6F4
+A6F5
+A6F6
+A6F7
+A6F8
+A6F9
+A6FA
+A6FB
+A6FC
+A6FD
+A6FE
+A7C2
+A7C3
+A7C4
+A7C5
+A7C6
+A7C7
+A7C8
+A7C9
+A7CA
+A7CB
+A7CC
+A7CD
+A7CE
+A7CF
+A7D0
+A7F2
+A7F3
+A7F4
+A7F5
+A7F6
+A7F7
+A7F8
+A7F9
+A7FA
+A7FB
+A7FC
+A7FD
+A7FE
+A8C1
+A8C2
+A8C3
+A8C4
+A8C5
+A8C6
+A8C7
+A8C8
+A8C9
+A8CA
+A8CB
+A8CC
+A8CD
+A8CE
+A8CF
+A8D0
+A8D1
+A8D2
+A8D3
+A8D4
+A8D5
+A8D6
+A8D7
+A8D8
+A8D9
+A8DA
+A8DB
+A8DC
+A8DD
+A8DE
+A8DF
+A8E0
+A8E1
+A8E2
+A8E3
+A8E4
+A8E5
+A8E6
+A8E7
+A8E8
+A8E9
+A8EA
+A8EB
+A8EC
+A8ED
+A8EE
+A8EF
+A8F0
+A8F1
+A8F2
+A8F3
+A8F4
+A8F5
+A8F6
+A8F7
+A8F8
+A8F9
+A8FA
+A8FB
+A8FC
+A8FD
+A8FE
+A9A1
+A9A2
+A9A3
+A9A4
+A9A5
+A9A6
+A9A7
+A9A8
+A9A9
+A9AA
+A9AB
+A9AC
+A9AD
+A9AE
+A9AF
+A9B0
+A9B1
+A9B2
+A9B3
+A9B4
+A9B5
+A9B6
+A9B7
+A9B8
+A9B9
+A9BA
+A9BB
+A9BC
+A9BD
+A9BE
+A9BF
+A9C0
+A9C1
+A9C2
+A9C3
+A9C4
+A9C5
+A9C6
+A9C7
+A9C8
+A9C9
+A9CA
+A9CB
+A9CC
+A9CD
+A9CE
+A9CF
+A9D0
+A9D1
+A9D2
+A9D3
+A9D4
+A9D5
+A9D6
+A9D7
+A9D8
+A9D9
+A9DA
+A9DB
+A9DC
+A9DD
+A9DE
+A9DF
+A9E0
+A9E1
+A9E2
+A9E3
+A9E4
+A9E5
+A9E6
+A9E7
+A9E8
+A9E9
+A9EA
+A9EB
+A9EC
+A9ED
+A9EE
+A9EF
+A9F0
+A9F1
+A9F2
+A9F3
+A9F4
+A9F5
+A9F6
+A9F7
+A9F8
+A9F9
+A9FA
+A9FB
+A9FC
+A9FD
+A9FE
+AAA1
+AAA2
+AAA3
+AAA4
+AAA5
+AAA6
+AAA7
+AAA8
+AAA9
+AAAA
+AAAB
+AAAC
+AAAD
+AAAE
+AAAF
+AAB0
+AAB1
+AAB2
+AAB3
+AAB4
+AAB5
+AAB6
+AAB7
+AAB8
+AAB9
+AABA
+AABB
+AABC
+AABD
+AABE
+AABF
+AAC0
+AAC1
+AAC2
+AAC3
+AAC4
+AAC5
+AAC6
+AAC7
+AAC8
+AAC9
+AACA
+AACB
+AACC
+AACD
+AACE
+AACF
+AAD0
+AAD1
+AAD2
+AAD3
+AAD4
+AAD5
+AAD6
+AAD7
+AAD8
+AAD9
+AADA
+AADB
+AADC
+AADD
+AADE
+AADF
+AAE0
+AAE1
+AAE2
+AAE3
+AAE4
+AAE5
+AAE6
+AAE7
+AAE8
+AAE9
+AAEA
+AAEB
+AAEC
+AAED
+AAEE
+AAEF
+AAF0
+AAF1
+AAF2
+AAF3
+AAF4
+AAF5
+AAF6
+AAF7
+AAF8
+AAF9
+AAFA
+AAFB
+AAFC
+AAFD
+AAFE
+ABA1
+ABA2
+ABA3
+ABA4
+ABA5
+ABA6
+ABA7
+ABA8
+ABA9
+ABAA
+ABAB
+ABAC
+ABAD
+ABAE
+ABAF
+ABB0
+ABB1
+ABB2
+ABB3
+ABB4
+ABB5
+ABB6
+ABB7
+ABB8
+ABB9
+ABBA
+ABBB
+ABBC
+ABBD
+ABBE
+ABBF
+ABC0
+ABC1
+ABC2
+ABC3
+ABC4
+ABC5
+ABC6
+ABC7
+ABC8
+ABC9
+ABCA
+ABCB
+ABCC
+ABCD
+ABCE
+ABCF
+ABD0
+ABD1
+ABD2
+ABD3
+ABD4
+ABD5
+ABD6
+ABD7
+ABD8
+ABD9
+ABDA
+ABDB
+ABDC
+ABDD
+ABDE
+ABDF
+ABE0
+ABE1
+ABE2
+ABE3
+ABE4
+ABE5
+ABE6
+ABE7
+ABE8
+ABE9
+ABEA
+ABEB
+ABEC
+ABED
+ABEE
+ABEF
+ABF0
+ABF1
+ABF2
+ABF3
+ABF4
+ABF5
+ABF6
+ABF7
+ABF8
+ABF9
+ABFA
+ABFB
+ABFC
+ABFD
+ABFE
+ACA1
+ACA2
+ACA3
+ACA4
+ACA5
+ACA6
+ACA7
+ACA8
+ACA9
+ACAA
+ACAB
+ACAC
+ACAD
+ACAE
+ACAF
+ACB0
+ACB1
+ACB2
+ACB3
+ACB4
+ACB5
+ACB6
+ACB7
+ACB8
+ACB9
+ACBA
+ACBB
+ACBC
+ACBD
+ACBE
+ACBF
+ACC0
+ACC1
+ACC2
+ACC3
+ACC4
+ACC5
+ACC6
+ACC7
+ACC8
+ACC9
+ACCA
+ACCB
+ACCC
+ACCD
+ACCE
+ACCF
+ACD0
+ACD1
+ACD2
+ACD3
+ACD4
+ACD5
+ACD6
+ACD7
+ACD8
+ACD9
+ACDA
+ACDB
+ACDC
+ACDD
+ACDE
+ACDF
+ACE0
+ACE1
+ACE2
+ACE3
+ACE4
+ACE5
+ACE6
+ACE7
+ACE8
+ACE9
+ACEA
+ACEB
+ACEC
+ACED
+ACEE
+ACEF
+ACF0
+ACF1
+ACF2
+ACF3
+ACF4
+ACF5
+ACF6
+ACF7
+ACF8
+ACF9
+ACFA
+ACFB
+ACFC
+ACFD
+ACFE
+ADA1
+ADA2
+ADA3
+ADA4
+ADA5
+ADA6
+ADA7
+ADA8
+ADA9
+ADAA
+ADAB
+ADAC
+ADAD
+ADAE
+ADAF
+ADB0
+ADB1
+ADB2
+ADB3
+ADB4
+ADB5
+ADB6
+ADB7
+ADB8
+ADB9
+ADBA
+ADBB
+ADBC
+ADBD
+ADBE
+ADBF
+ADC0
+ADC1
+ADC2
+ADC3
+ADC4
+ADC5
+ADC6
+ADC7
+ADC8
+ADC9
+ADCA
+ADCB
+ADCC
+ADCD
+ADCE
+ADCF
+ADD0
+ADD1
+ADD2
+ADD3
+ADD4
+ADD5
+ADD6
+ADD7
+ADD8
+ADD9
+ADDA
+ADDB
+ADDC
+ADDD
+ADDE
+ADDF
+ADE0
+ADE1
+ADE2
+ADE3
+ADE4
+ADE5
+ADE6
+ADE7
+ADE8
+ADE9
+ADEA
+ADEB
+ADEC
+ADED
+ADEE
+ADEF
+ADF0
+ADF1
+ADF2
+ADF3
+ADF4
+ADF5
+ADF6
+ADF7
+ADF8
+ADF9
+ADFA
+ADFB
+ADFC
+ADFD
+ADFE
+AEA1
+AEA2
+AEA3
+AEA4
+AEA5
+AEA6
+AEA7
+AEA8
+AEA9
+AEAA
+AEAB
+AEAC
+AEAD
+AEAE
+AEAF
+AEB0
+AEB1
+AEB2
+AEB3
+AEB4
+AEB5
+AEB6
+AEB7
+AEB8
+AEB9
+AEBA
+AEBB
+AEBC
+AEBD
+AEBE
+AEBF
+AEC0
+AEC1
+AEC2
+AEC3
+AEC4
+AEC5
+AEC6
+AEC7
+AEC8
+AEC9
+AECA
+AECB
+AECC
+AECD
+AECE
+AECF
+AED0
+AED1
+AED2
+AED3
+AED4
+AED5
+AED6
+AED7
+AED8
+AED9
+AEDA
+AEDB
+AEDC
+AEDD
+AEDE
+AEDF
+AEE0
+AEE1
+AEE2
+AEE3
+AEE4
+AEE5
+AEE6
+AEE7
+AEE8
+AEE9
+AEEA
+AEEB
+AEEC
+AEED
+AEEE
+AEEF
+AEF0
+AEF1
+AEF2
+AEF3
+AEF4
+AEF5
+AEF6
+AEF7
+AEF8
+AEF9
+AEFA
+AEFB
+AEFC
+AEFD
+AEFE
+AFA1
+AFA2
+AFA3
+AFA4
+AFA5
+AFA6
+AFA7
+AFA8
+AFA9
+AFAA
+AFAB
+AFAC
+AFAD
+AFAE
+AFAF
+AFB0
+AFB1
+AFB2
+AFB3
+AFB4
+AFB5
+AFB6
+AFB7
+AFB8
+AFB9
+AFBA
+AFBB
+AFBC
+AFBD
+AFBE
+AFBF
+AFC0
+AFC1
+AFC2
+AFC3
+AFC4
+AFC5
+AFC6
+AFC7
+AFC8
+AFC9
+AFCA
+AFCB
+AFCC
+AFCD
+AFCE
+AFCF
+AFD0
+AFD1
+AFD2
+AFD3
+AFD4
+AFD5
+AFD6
+AFD7
+AFD8
+AFD9
+AFDA
+AFDB
+AFDC
+AFDD
+AFDE
+AFDF
+AFE0
+AFE1
+AFE2
+AFE3
+AFE4
+AFE5
+AFE6
+AFE7
+AFE8
+AFE9
+AFEA
+AFEB
+AFEC
+AFED
+AFEE
+AFEF
+AFF0
+AFF1
+AFF2
+AFF3
+AFF4
+AFF5
+AFF6
+AFF7
+AFF8
+AFF9
+AFFA
+AFFB
+AFFC
+AFFD
+AFFE
+CFD4
+CFD5
+CFD6
+CFD7
+CFD8
+CFD9
+CFDA
+CFDB
+CFDC
+CFDD
+CFDE
+CFDF
+CFE0
+CFE1
+CFE2
+CFE3
+CFE4
+CFE5
+CFE6
+CFE7
+CFE8
+CFE9
+CFEA
+CFEB
+CFEC
+CFED
+CFEE
+CFEF
+CFF0
+CFF1
+CFF2
+CFF3
+CFF4
+CFF5
+CFF6
+CFF7
+CFF8
+CFF9
+CFFA
+CFFB
+CFFC
+CFFD
+CFFE
+F4A7
+F4A8
+F4A9
+F4AA
+F4AB
+F4AC
+F4AD
+F4AE
+F4AF
+F4B0
+F4B1
+F4B2
+F4B3
+F4B4
+F4B5
+F4B6
+F4B7
+F4B8
+F4B9
+F4BA
+F4BB
+F4BC
+F4BD
+F4BE
+F4BF
+F4C0
+F4C1
+F4C2
+F4C3
+F4C4
+F4C5
+F4C6
+F4C7
+F4C8
+F4C9
+F4CA
+F4CB
+F4CC
+F4CD
+F4CE
+F4CF
+F4D0
+F4D1
+F4D2
+F4D3
+F4D4
+F4D5
+F4D6
+F4D7
+F4D8
+F4D9
+F4DA
+F4DB
+F4DC
+F4DD
+F4DE
+F4DF
+F4E0
+F4E1
+F4E2
+F4E3
+F4E4
+F4E5
+F4E6
+F4E7
+F4E8
+F4E9
+F4EA
+F4EB
+F4EC
+F4ED
+F4EE
+F4EF
+F4F0
+F4F1
+F4F2
+F4F3
+F4F4
+F4F5
+F4F6
+F4F7
+F4F8
+F4F9
+F4FA
+F4FB
+F4FC
+F4FD
+F4FE
+DROP TABLE t1;
+SET collation_connection='ujis_japanese_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ujis_japanese_ci 6109
+ujis_japanese_ci 61
+ujis_japanese_ci 6120
+drop table t1;
+SET collation_connection='ujis_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+ujis_bin 6109
+ujis_bin 61
+ujis_bin 6120
+drop table t1;
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index 945ec8eae99..13105e2276c 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -412,7 +412,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 default NULL,
- UNIQUE KEY `a` (`c`(1))
+ UNIQUE KEY `a` TYPE HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -570,7 +570,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c` char(10) character set utf8 collate utf8_bin default NULL,
- UNIQUE KEY `a` (`c`(1))
+ UNIQUE KEY `a` TYPE HASH (`c`(1))
) ENGINE=HEAP DEFAULT CHARSET=latin1
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
insert into t1 values ('aa');
@@ -814,3 +814,53 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2;
drop table t1;
+select 'c' like '\_' as want0;
+want0
+0
+create table t1 (id integer, a varchar(100) character set utf8 collate utf8_unicode_ci);
+insert into t1 values (1, 'Test');
+select * from t1 where soundex(a) = soundex('Test');
+id a
+1 Test
+select * from t1 where soundex(a) = soundex('TEST');
+id a
+1 Test
+select * from t1 where soundex(a) = soundex('test');
+id a
+1 Test
+drop table t1;
+SET collation_connection='utf8_general_ci';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+utf8_general_ci 6109
+utf8_general_ci 61
+utf8_general_ci 6120
+drop table t1;
+SET collation_connection='utf8_bin';
+create table t1 select repeat('a',4000) a;
+delete from t1;
+insert into t1 values ('a'), ('a '), ('a\t');
+select collation(a),hex(a) from t1 order by a;
+collation(a) hex(a)
+utf8_bin 6109
+utf8_bin 61
+utf8_bin 6120
+drop table t1;
+CREATE TABLE t1 (
+user varchar(255) NOT NULL default ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES ('one'),('two');
+SELECT CHARSET('a');
+CHARSET('a')
+utf8
+SELECT user, CONCAT('<', user, '>') AS c FROM t1;
+user c
+one <one>
+two <two>
+DROP TABLE t1;
+select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8);
+convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8)
+1
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index 758a83defed..2db014c4a52 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -296,6 +296,9 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
+select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
+concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
+2003-01-02 08:11:02.123456
truncate table t1;
insert into t1 values
('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index 5575ee1bf98..411cd52b4ca 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -16,12 +16,34 @@ SET AUTOCOMMIT=0;
DELETE from t1;
SET AUTOCOMMIT=1;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
+create table t1 (
+a bigint not null,
+b bigint not null default 0,
+c bigint not null default 0,
+d bigint not null default 0,
+e bigint not null default 0,
+f bigint not null default 0,
+g bigint not null default 0,
+h bigint not null default 0,
+i bigint not null default 0,
+j bigint not null default 0,
+primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23);
delete from t1 where a=26;
drop table t1;
-create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
-insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
+create table t1 (
+a bigint not null,
+b bigint not null default 0,
+c bigint not null default 0,
+d bigint not null default 0,
+e bigint not null default 0,
+f bigint not null default 0,
+g bigint not null default 0,
+h bigint not null default 0,
+i bigint not null default 0,
+j bigint not null default 0,
+primary key (a,b,c,d,e,f,g,h,i,j));
+insert into t1 (a) values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
delete from t1 where a=27;
drop table t1;
CREATE TABLE `t1` (
@@ -141,3 +163,12 @@ select * from t1;
a b
7 7
drop table t1;
+CREATE TABLE t1 ( a int PRIMARY KEY );
+DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a;
+INSERT INTO t1 VALUES (0),(1),(2);
+DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a LIMIT 1;
+SELECT * FROM t1;
+a
+0
+2
+DROP TABLE t1;
diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result
index 7e6b9b44566..b4d9a921178 100644
--- a/mysql-test/r/derived.result
+++ b/mysql-test/r/derived.result
@@ -330,3 +330,31 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
min max avg
10.00 10.00 10
DROP TABLE t1;
+create table t1 (a integer, b integer);
+insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
+select distinct sum(b) from t1 group by a;
+sum(b)
+4
+select distinct sum(b) from (select a,b from t1) y group by a;
+sum(b)
+4
+drop table t1;
+create table t1(a int);
+create table t2(a int);
+create table t3(a int);
+insert into t1 values(1),(1);
+insert into t2 values(2),(2);
+insert into t3 values(3),(3);
+select * from t1 union distinct select * from t2 union all select * from t3;
+a
+1
+2
+3
+3
+select * from (select * from t1 union distinct select * from t2 union all select * from t3) X;
+a
+1
+2
+3
+3
+drop table t1, t2, t3;
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 80af2dd0983..f4bc4263c4d 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -190,7 +190,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
-1 SIMPLE t3 ref a a 5 test.t1.a 10 Using where; Using index; Distinct
+1 SIMPLE t3 ref a a 5 test.t1.a 11 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result
index 8b919964163..223ceb003b3 100644
--- a/mysql-test/r/drop.result
+++ b/mysql-test/r/drop.result
@@ -1,5 +1,6 @@
drop table if exists t1;
drop database if exists mysqltest;
+drop database if exists client_test_db;
drop table t1;
ERROR 42S02: Unknown table 't1'
create table t1(n int);
diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result
index 99ee0143c05..5f1f142cde5 100644
--- a/mysql-test/r/drop_temp_table.result
+++ b/mysql-test/r/drop_temp_table.result
@@ -1,7 +1,9 @@
reset master;
create database `drop-temp+table-test`;
use `drop-temp+table-test`;
+create temporary table shortn1 (a int);
create temporary table `table:name` (a int);
+create temporary table shortn2 (a int);
select get_lock("a",10);
get_lock("a",10)
1
@@ -10,9 +12,11 @@ get_lock("a",10)
1
show binlog events;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
-master-bin.000001 79 Query 1 79 use `test`; create database `drop-temp+table-test`
-master-bin.000001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int)
-master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name`
-master-bin.000001 375 Query 1 375 use `drop-temp+table-test`; DO RELEASE_LOCK("a")
+master-bin.000001 # Start 1 # Server ver: VERSION, Binlog ver: 3
+master-bin.000001 # Query 1 # create database `drop-temp+table-test`
+master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int)
+master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int)
+master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int)
+master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1`
+master-bin.000001 # Query 1 # use `drop-temp+table-test`; DO RELEASE_LOCK("a")
drop database `drop-temp+table-test`;
diff --git a/mysql-test/r/flush_block_commit.result b/mysql-test/r/flush_block_commit.result
index 17991f15382..2e9f1920937 100644
--- a/mysql-test/r/flush_block_commit.result
+++ b/mysql-test/r/flush_block_commit.result
@@ -20,4 +20,20 @@ commit;
a
1
unlock tables;
+commit;
+begin;
+insert into t1 values(10);
+flush tables with read lock;
+commit;
+unlock tables;
+flush tables with read lock;
+unlock tables;
+begin;
+select * from t1;
+a
+1
+10
+show create database test;
+Database Create Database
+test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
drop table t1;
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 30c4c75f3d1..dd5b0407eb3 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -148,6 +148,9 @@ select * from t1 where MATCH a,b AGAINST ('+(support collections) +foobar*' IN B
a b
select * from t1 where MATCH a,b AGAINST ('+(+(support collections)) +foobar*' IN BOOLEAN MODE);
a b
+select * from t1 where MATCH a,b AGAINST ('+collections -supp* -foobar*' IN BOOLEAN MODE);
+a b
+Full-text indexes are called collections
select * from t1 where MATCH a,b AGAINST ('"xt indexes"' IN BOOLEAN MODE);
a b
select * from t1 where MATCH a,b AGAINST('"space model' IN BOOLEAN MODE);
@@ -190,6 +193,14 @@ a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
a
aaa10 bbb20
+select * from t1 where match a against ("+(+aaa* +bbb1*)" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
+select * from t1 where match a against ("(+aaa* +bbb1*)" in boolean mode);
+a
+aaa20 bbb15
+aaa30 bbb10
drop table t1;
CREATE TABLE t1 (
id int(11),
@@ -330,6 +341,9 @@ t1_id name t2_id t1_id name
select * from t2 where match name against ('a* b* c* d* e* f*' in boolean mode);
t2_id t1_id name
drop table t1,t2;
+create table t1 (a text, fulltext key (a));
+insert into t1 select "xxxx yyyy zzzz";
+drop table t1;
SET NAMES latin1;
CREATE TABLE t1 (t text character set utf8 not null, fulltext(t));
INSERT t1 VALUES ('Mit freundlichem Grüß'), ('aus Osnabrück');
@@ -352,10 +366,15 @@ t collation(t)
aus Osnabrück utf8_general_ci
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrueck');
t collation(t)
-SELECT t, collation(t),MATCH t AGAINST ('Osnabruck') FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
-t collation(t) MATCH t AGAINST ('Osnabruck')
-aus Osnabrück utf8_general_ci 1.591139793396
+SELECT t, collation(t),FORMAT(MATCH t AGAINST ('Osnabruck'),6) FROM t1 WHERE MATCH t AGAINST ('Osnabruck');
+t collation(t) FORMAT(MATCH t AGAINST ('Osnabruck'),6)
+aus Osnabrück utf8_general_ci 1.591140
alter table t1 modify t varchar(200) collate latin1_german2_ci not null;
+Warnings:
+Warning 1265 Data truncated for column 't' at row 3
+Warning 1265 Data truncated for column 't' at row 4
+Warning 1265 Data truncated for column 't' at row 5
+Warning 1265 Data truncated for column 't' at row 6
SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrück');
t collation(t)
aus Osnabrück latin1_german2_ci
@@ -374,3 +393,31 @@ s
pära para para
para para para
DROP TABLE t1;
+CREATE TABLE t1 (h text, FULLTEXT (h));
+INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+select count(*) from t1;
+count(*)
+1
+drop table t1;
+CREATE TABLE t1 ( a TEXT, FULLTEXT (a) );
+INSERT INTO t1 VALUES ('testing ft_nlq_find_relevance');
+SELECT MATCH(a) AGAINST ('nosuchword') FROM t1;
+MATCH(a) AGAINST ('nosuchword')
+0
+DROP TABLE t1;
+create table t1 (a int primary key, b text, fulltext(b));
+create table t2 (a int, b text);
+insert t1 values (1, "aaaa"), (2, "bbbb");
+insert t2 values (10, "aaaa"), (2, "cccc");
+replace t1 select * from t2;
+drop table t1, t2;
+CREATE TABLE t1 (t VARCHAR(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci, FULLTEXT (t));
+SET NAMES latin1;
+INSERT INTO t1 VALUES('Mit freundlichem Grüß aus Osnabrück');
+SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE);
+COUNT(*)
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/fulltext_cache.result b/mysql-test/r/fulltext_cache.result
index 6a94189d8b4..80c101357c5 100644
--- a/mysql-test/r/fulltext_cache.result
+++ b/mysql-test/r/fulltext_cache.result
@@ -21,17 +21,17 @@ INSERT INTO t2 VALUES (5,2,'um copo de Vodka');
INSERT INTO t2 VALUES (6,2,'um chocolate Snickers');
INSERT INTO t2 VALUES (7,1,'Bife');
INSERT INTO t2 VALUES (8,1,'Pizza de Salmao');
-SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
-aaaaaaaaa dsaass de sushi 1 1.92378664
-aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
-aaaaaaaaa dsaass de Feijoada 3 0.00000000
-aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
-ssde df s fsda sad er um copo de Vodka 5 0.00000000
-ssde df s fsda sad er um chocolate Snickers 6 0.00000000
-aaaaaaaaa dsaass de Bife 7 0.00000000
-aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
+aaaaaaaaa dsaass de sushi 1 1.923787
+aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000
+aaaaaaaaa dsaass de Feijoada 3 0.000000
+aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000
+ssde df s fsda sad er um copo de Vodka 5 0.000000
+ssde df s fsda sad er um chocolate Snickers 6 0.000000
+aaaaaaaaa dsaass de Bife 7 0.000000
+aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t1, t2 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
@@ -43,17 +43,17 @@ ssde df s fsda sad er um copo de Vodka 5 0
ssde df s fsda sad er um chocolate Snickers 6 0
aaaaaaaaa dsaass de Bife 7 0
aaaaaaaaa dsaass de Pizza de Salmao 8 0
-SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),8)
+SELECT t1.q, t2.item, t2.id, round(MATCH t2.item AGAINST ('sushi'),6)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
-aaaaaaaaa dsaass de sushi 1 1.92378664
-aaaaaaaaa dsaass de Bolo de Chocolate 2 0.00000000
-aaaaaaaaa dsaass de Feijoada 3 0.00000000
-aaaaaaaaa dsaass de Mousse de Chocolate 4 0.00000000
-ssde df s fsda sad er um copo de Vodka 5 0.00000000
-ssde df s fsda sad er um chocolate Snickers 6 0.00000000
-aaaaaaaaa dsaass de Bife 7 0.00000000
-aaaaaaaaa dsaass de Pizza de Salmao 8 0.00000000
+aaaaaaaaa dsaass de sushi 1 1.923787
+aaaaaaaaa dsaass de Bolo de Chocolate 2 0.000000
+aaaaaaaaa dsaass de Feijoada 3 0.000000
+aaaaaaaaa dsaass de Mousse de Chocolate 4 0.000000
+ssde df s fsda sad er um copo de Vodka 5 0.000000
+ssde df s fsda sad er um chocolate Snickers 6 0.000000
+aaaaaaaaa dsaass de Bife 7 0.000000
+aaaaaaaaa dsaass de Pizza de Salmao 8 0.000000
SELECT t1.q, t2.item, t2.id, MATCH t2.item AGAINST ('sushi' IN BOOLEAN MODE)
as x FROM t2, t1 WHERE (t2.id2 = t1.id) ORDER BY x DESC,t2.id;
q item id x
diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result
index bfee9eba280..c6c42fa2e8b 100644
--- a/mysql-test/r/fulltext_order_by.result
+++ b/mysql-test/r/fulltext_order_by.result
@@ -6,53 +6,53 @@ FULLTEXT(message)
) comment = 'original testcase by sroussey@network54.com';
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
("steve"),("is"),("cool"),("steve is cool");
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve');
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
-a MATCH (message) AGAINST ('steve')
-4 0.90587323904037
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+4 0.905873
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
4 1
7 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
-4 0.90587323904037
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
4 1
-SELECT a, MATCH (message) AGAINST ('steve') FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
-a MATCH (message) AGAINST ('steve')
-7 0.89568990468979
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
+a FORMAT(MATCH (message) AGAINST ('steve'),6)
+7 0.895690
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
a MATCH (message) AGAINST ('steve' IN BOOLEAN MODE)
7 1
-SELECT a, MATCH (message) AGAINST ('steve') as rel FROM t1 ORDER BY rel;
+SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
a rel
-1 0
-2 0
-3 0
-5 0
-6 0
-7 0.89568990468979
-4 0.90587323904037
+1 0.000000
+2 0.000000
+3 0.000000
+5 0.000000
+6 0.000000
+7 0.895690
+4 0.905873
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
a rel
1 0
diff --git a/mysql-test/r/func_compress.result b/mysql-test/r/func_compress.result
index 11dbcca9431..9bc8e417e19 100644
--- a/mysql-test/r/func_compress.result
+++ b/mysql-test/r/func_compress.result
@@ -69,6 +69,6 @@ Error 1259 ZLIB: Input data corrupted
Error 1256 Uncompressed data size too large; the maximum size is 1048576 (probably, length of uncompressed data was corrupted)
drop table t1;
set @@max_allowed_packet=1048576*100;
-select compress(repeat('aaaaaaaaaa', 10000000)) is null;
-compress(repeat('aaaaaaaaaa', 10000000)) is null
+select compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null;
+compress(repeat('aaaaaaaaaa', IF(XXX, 10, 10000000))) is null
0
diff --git a/mysql-test/r/func_concat.result b/mysql-test/r/func_concat.result
index ec53d6d87b0..cf6fbf2da4f 100644
--- a/mysql-test/r/func_concat.result
+++ b/mysql-test/r/func_concat.result
@@ -32,3 +32,35 @@ select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
a b c d
AAAA 105 2003-03-01 1
drop table t1;
+select 'a' union select concat('a', -4);
+a
+a
+a-4
+select 'a' union select concat('a', -4.5);
+a
+a
+a-4.5
+select 'a' union select concat('a', -(4 + 1));
+a
+a
+a-5
+select 'a' union select concat('a', 4 - 5);
+a
+a
+a-1
+select 'a' union select concat('a', -'3');
+a
+a
+a-3
+select 'a' union select concat('a', -concat('3',4));
+a
+a
+a-34
+select 'a' union select concat('a', -0);
+a
+a
+a0
+select 'a' union select concat('a', -0.0);
+a
+a
+good
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index aa202823c77..390b33fdddc 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -457,3 +457,8 @@ group_concat(distinct b order by b)
Warnings:
Warning 1260 2 line(s) were cut by GROUP_CONCAT()
drop table t1;
+CREATE TABLE t1 (id int);
+SELECT GROUP_CONCAT(id) AS gc FROM t1 HAVING gc IS NULL;
+gc
+NULL
+DROP TABLE t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index c25f89d4df3..fa645700875 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -637,8 +637,22 @@ create table t1 (a char(10));
insert into t1 values ('a'),('b'),('c');
select coercibility(max(a)) from t1;
coercibility(max(a))
-3
+2
drop table t1;
+create table t1 (a char character set latin2);
+insert into t1 values ('a'),('b');
+select charset(max(a)), coercibility(max(a)),
+charset(min(a)), coercibility(min(a)) from t1;
+charset(max(a)) coercibility(max(a)) charset(min(a)) coercibility(min(a))
+latin2 2 latin2 2
+create table t2 select max(a),min(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `max(a)` char(1) character set latin2 default NULL,
+ `min(a)` char(1) character set latin2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t2,t1;
create table t1 (a int);
insert into t1 values (1);
select max(a) as b from t1 having b=1;
@@ -719,3 +733,15 @@ one 2
two 2
three 1
drop table t1;
+create table t1(f1 datetime);
+insert into t1 values (now());
+create table t2 select f2 from (select max(now()) f2 from t1) a;
+show columns from t2;
+Field Type Null Key Default Extra
+f2 datetime 0000-00-00 00:00:00
+drop table t2;
+create table t2 select f2 from (select now() f2 from t1) a;
+show columns from t2;
+Field Type Null Key Default Extra
+f2 datetime 0000-00-00 00:00:00
+drop table t2, t1;
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index 374affce8c5..516d0a28a21 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -157,6 +157,14 @@ a
bbbb
цццц
drop table t1;
+create table t1 (a char(10) character set latin1 not null);
+insert into t1 values ('a'),('b'),('c');
+select a from t1 where a IN ('a','b','c') order by a;
+a
+a
+b
+c
+drop table t1;
set names latin1;
select '1.0' in (1,2);
'1.0' in (1,2)
@@ -179,3 +187,9 @@ select 1 in ('1.1',2);
select 1 in ('1.1',2.0);
1 in ('1.1',2.0)
0
+create table t1 (a char(20) character set binary);
+insert into t1 values ('aa'), ('bb');
+select * from t1 where a in (NULL, 'aa');
+a
+aa
+drop table t1;
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 90aa04515d7..3a28cccfac5 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -124,3 +124,5 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
+select rand(rand);
+ERROR 42S22: Unknown column 'rand' in 'field list'
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index 5a9f0f68228..2d464c891bf 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -28,3 +28,24 @@ length(format('nan', 2)) > 0
select concat("$",format(2500,2));
concat("$",format(2500,2))
$2,500.00
+create table t1 ( a timestamp );
+insert into t1 values ( '2004-01-06 12:34' );
+select a from t1 where left(a+0,6) in ( left(20040106,6) );
+a
+2004-01-06 12:34:00
+select a from t1 where left(a+0,6) = ( left(20040106,6) );
+a
+2004-01-06 12:34:00
+select a from t1 where right(a+0,6) in ( right(20040106123400,6) );
+a
+2004-01-06 12:34:00
+select a from t1 where right(a+0,6) = ( right(20040106123400,6) );
+a
+2004-01-06 12:34:00
+select a from t1 where mid(a+0,6,3) in ( mid(20040106123400,6,3) );
+a
+2004-01-06 12:34:00
+select a from t1 where mid(a+0,6,3) = ( mid(20040106123400,6,3) );
+a
+2004-01-06 12:34:00
+drop table t1;
diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result
index cf2bd687115..c74d6fc5a4e 100644
--- a/mysql-test/r/func_sapdb.result
+++ b/mysql-test/r/func_sapdb.result
@@ -97,13 +97,16 @@ timediff("1997-12-31 23:59:59.000001","1997-12-30 01:01:01.000002")
46:58:57.999999
select timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002");
timediff("1997-12-30 23:59:59.000001","1997-12-31 23:59:59.000002")
--23:59:59.999999
+-24:00:00.000001
select timediff("1997-12-31 23:59:59.000001","23:59:59.000001");
timediff("1997-12-31 23:59:59.000001","23:59:59.000001")
NULL
select timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001");
timediff("2000:01:01 00:00:00", "2000:01:01 00:00:00.000001")
-00:00:00.000001
+select timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50");
+timediff("2005-01-11 15:48:49.999999", "2005-01-11 15:48:50")
+-00:00:00.000001
select maketime(10,11,12);
maketime(10,11,12)
10:11:12
@@ -175,7 +178,7 @@ f8 date YES NULL
f9 time YES NULL
select * from t1;
f1 f2 f3 f4 f5 f6 f7 f8 f9
-1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -23:59:59 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
+1997-01-01 1998-01-02 01:01:00 49:01:01 46:58:57 -24:00:00 10:11:12 2001-12-01 01:01:01 1997-12-31 23:59:59
create table test(t1 datetime, t2 time, t3 time, t4 datetime);
insert into test values
('2001-01-01 01:01:01', '01:01:01', null, '2001-02-01 01:01:01'),
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 4a3a70274fd..f238915d3b9 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -201,6 +201,9 @@ hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex(
select length(unhex(md5("abrakadabra")));
length(unhex(md5("abrakadabra")))
16
+select concat('a', quote(NULL));
+concat('a', quote(NULL))
+aNULL
select reverse("");
reverse("")
@@ -312,7 +315,7 @@ insert into t1 values ('one'),(NULL),('two'),('four');
select a, quote(a), isnull(quote(a)), quote(a) is null, ifnull(quote(a), 'n') from t1;
a quote(a) isnull(quote(a)) quote(a) is null ifnull(quote(a), 'n')
one 'one' 0 0 'one'
-NULL NULL 1 1 n
+NULL NULL 0 0 NULL
two 'two' 0 0 'two'
four 'four' 0 0 'four'
drop table t1;
@@ -322,6 +325,19 @@ trim(trailing 'foo' from 'foo')
select trim(leading 'foo' from 'foo');
trim(leading 'foo' from 'foo')
+select quote(ltrim(concat(' ', 'a')));
+quote(ltrim(concat(' ', 'a')))
+'a'
+select quote(trim(concat(' ', 'a')));
+quote(trim(concat(' ', 'a')))
+'a'
+CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
+SELECT QUOTE('A') FROM t1;
+QUOTE('A')
+'A'
+'A'
+'A'
+DROP TABLE t1;
select 1=_latin1'1';
1=_latin1'1'
1
@@ -460,7 +476,7 @@ collation(hex(130)) coercibility(hex(130))
latin1_swedish_ci 3
select collation(char(130)), coercibility(hex(130));
collation(char(130)) coercibility(hex(130))
-binary 3
+latin1_swedish_ci 3
select collation(format(130,10)), coercibility(format(130,10));
collation(format(130,10)) coercibility(format(130,10))
latin1_swedish_ci 3
@@ -682,3 +698,44 @@ drop table t1;
select left(1234, 3) + 0;
left(1234, 3) + 0
123
+create table t1 (a int not null primary key, b varchar(40), c datetime);
+insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
+select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
+total reg
+10 2004-12-10
+drop table t1;
+select trim(null from 'kate') as "must_be_null";
+must_be_null
+NULL
+select trim('xyz' from null) as "must_be_null";
+must_be_null
+NULL
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+a bigint(20) unsigned default NULL,
+PRIMARY KEY (id)
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES
+('0','16307858876001849059');
+SELECT CONV('e251273eb74a8ee3', 16, 10);
+CONV('e251273eb74a8ee3', 16, 10)
+16307858876001849059
+EXPLAIN
+SELECT id
+FROM t1
+WHERE a = 16307858876001849059;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+EXPLAIN
+SELECT id
+FROM t1
+WHERE a = CONV('e251273eb74a8ee3', 16, 10);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1
+DROP TABLE t1;
+SELECT CHAR(NULL,121,83,81,'76') as my_column;
+my_column
+ySQL
+SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column;
+my_column
+4
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 2dc6bffd071..4dd00ab74a1 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -474,6 +474,15 @@ unix_timestamp(@a)
select unix_timestamp('1969-12-01 19:00:01');
unix_timestamp('1969-12-01 19:00:01')
0
+select from_unixtime(-1);
+from_unixtime(-1)
+NULL
+select from_unixtime(2145916800);
+from_unixtime(2145916800)
+NULL
+select from_unixtime(0);
+from_unixtime(0)
+1970-01-01 03:00:00
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date, time time);
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02", "06:07:08");
SELECT * from t1;
diff --git a/mysql-test/r/gis-rtree.result b/mysql-test/r/gis-rtree.result
index 3fb1a5dd31c..7b63654ffaf 100644
--- a/mysql-test/r/gis-rtree.result
+++ b/mysql-test/r/gis-rtree.result
@@ -757,3 +757,50 @@ SPATIAL KEY(g)
) ENGINE=MyISAM;
INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)'));
drop table t1;
+CREATE TABLE t1 (
+geoobjid INT NOT NULL,
+line LINESTRING NOT NULL,
+kind ENUM('po', 'pp', 'rr', 'dr', 'rd', 'ts', 'cl') NOT NULL DEFAULT 'po',
+name VARCHAR(32),
+SPATIAL KEY (line)
+) engine=myisam;
+ALTER TABLE t1 DISABLE KEYS;
+INSERT INTO t1 (name, kind, line) VALUES
+("Aadaouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
+("Aadassiye", "pp", GeomFromText("POINT(35.816667 36.216667)")),
+("Aadbel", "pp", GeomFromText("POINT(34.533333 36.100000)")),
+("Aadchit", "pp", GeomFromText("POINT(33.347222 35.423611)")),
+("Aadchite", "pp", GeomFromText("POINT(33.347222 35.423611)")),
+("Aadchit el Qoussair", "pp", GeomFromText("POINT(33.283333 35.483333)")),
+("Aaddaye", "pp", GeomFromText("POINT(36.716667 40.833333)")),
+("'Aadeissa", "pp", GeomFromText("POINT(32.823889 35.698889)")),
+("Aaderup", "pp", GeomFromText("POINT(55.216667 11.766667)")),
+("Qalaat Aades", "pp", GeomFromText("POINT(33.503333 35.377500)")),
+("A ad'ino", "pp", GeomFromText("POINT(54.812222 38.209167)")),
+("Aadi Noia", "pp", GeomFromText("POINT(13.800000 39.833333)")),
+("Aad La Macta", "pp", GeomFromText("POINT(35.779444 -0.129167)")),
+("Aadland", "pp", GeomFromText("POINT(60.366667 5.483333)")),
+("Aadliye", "pp", GeomFromText("POINT(33.366667 36.333333)")),
+("Aadloun", "pp", GeomFromText("POINT(33.403889 35.273889)")),
+("Aadma", "pp", GeomFromText("POINT(58.798333 22.663889)")),
+("Aadma Asundus", "pp", GeomFromText("POINT(58.798333 22.663889)")),
+("Aadmoun", "pp", GeomFromText("POINT(34.150000 35.650000)")),
+("Aadneram", "pp", GeomFromText("POINT(59.016667 6.933333)")),
+("Aadneskaar", "pp", GeomFromText("POINT(58.083333 6.983333)")),
+("Aadorf", "pp", GeomFromText("POINT(47.483333 8.900000)")),
+("Aadorp", "pp", GeomFromText("POINT(52.366667 6.633333)")),
+("Aadouane", "pp", GeomFromText("POINT(32.816667 35.983333)")),
+("Aadoui", "pp", GeomFromText("POINT(34.450000 35.983333)")),
+("Aadouiye", "pp", GeomFromText("POINT(34.583333 36.183333)")),
+("Aadouss", "pp", GeomFromText("POINT(33.512500 35.601389)")),
+("Aadra", "pp", GeomFromText("POINT(33.616667 36.500000)")),
+("Aadzi", "pp", GeomFromText("POINT(38.100000 64.850000)"));
+ALTER TABLE t1 ENABLE KEYS;
+INSERT INTO t1 (name, kind, line) VALUES ("austria", "pp", GeomFromText('LINESTRING(14.9906 48.9887,14.9946 48.9904,14.9947 48.9916)'));
+drop table t1;
+CREATE TABLE t1 (st varchar(100));
+INSERT INTO t1 VALUES ("Fake string");
+CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom));
+INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
+ERROR HY000: Unknown error
+drop table t1, t2;
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 2226c6e33c9..c51b07f09d6 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -581,3 +581,77 @@ t1 CREATE TABLE `t1` (
`POINT(1,3)` longblob NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
+geometry NOT NULL default '') ENGINE=MyISAM ;
+insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
+36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
+36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
+36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
+36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
+36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
+36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
+36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
+36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
+36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
+36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
+36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
+36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
+36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
+36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
+36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
+36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
+36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
+36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
+36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
+36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
+36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
+36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
+36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
+36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
+36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
+36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
+36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
+36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
+36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
+36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
+36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
+36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
+36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
+36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
+36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
+36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
+36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
+36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
+36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
+36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
+36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
+36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
+36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
+36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
+36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
+36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
+36.240569,-115.083135 36.240569,-115.079835
+36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
+36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
+36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
+36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
+36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
+36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
+36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
+36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
+36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
+36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
+36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
+36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
+36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
+36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
+36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85998;
+object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
+85998 MULTIPOLYGON 0 POINT(115.31877315203 -36.237472821022)
+select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
+t1 where object_id=85984;
+object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
+85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469)
+drop table t1;
diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result
index 141e96c8424..22b34ebef62 100644
--- a/mysql-test/r/grant.result
+++ b/mysql-test/r/grant.result
@@ -37,6 +37,28 @@ Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
delete from mysql.user where user='mysqltest_1';
flush privileges;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 10 0 0
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
+grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N 10 20 30
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
show grants for mysqltest_1@localhost;
Grants for mysqltest_1@localhost
@@ -134,6 +156,31 @@ ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
select 1;
1
1
+insert into mysql.user (host, user) values ('localhost', 'test11');
+insert into mysql.db (host, db, user, select_priv) values
+('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
+alter table mysql.db order by db asc;
+flush privileges;
+show grants for test11@localhost;
+Grants for test11@localhost
+GRANT USAGE ON *.* TO 'test11'@'localhost'
+GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
+GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
+alter table mysql.db order by db desc;
+flush privileges;
+show grants for test11@localhost;
+Grants for test11@localhost
+GRANT USAGE ON *.* TO 'test11'@'localhost'
+GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
+GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
+delete from mysql.user where user='test11';
+delete from mysql.db where user='test11';
+create database mysqltest1;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+host db user select_priv insert_priv
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
create table t1 (a int);
grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
show grants for drop_user2@localhost;
@@ -229,25 +276,6 @@ GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
DROP DATABASE ÂÄ;
SET NAMES latin1;
-insert into mysql.user (host, user) values ('localhost', 'test11');
-insert into mysql.db (host, db, user, select_priv) values
-('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
-alter table mysql.db order by db asc;
-flush privileges;
-show grants for test11@localhost;
-Grants for test11@localhost
-GRANT USAGE ON *.* TO 'test11'@'localhost'
-GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
-GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
-alter table mysql.db order by db desc;
-flush privileges;
-show grants for test11@localhost;
-Grants for test11@localhost
-GRANT USAGE ON *.* TO 'test11'@'localhost'
-GRANT SELECT ON `ab%`.* TO 'test11'@'localhost'
-GRANT SELECT ON `a%`.* TO 'test11'@'localhost'
-delete from mysql.user where user='test11';
-delete from mysql.db where user='test11';
USE test;
CREATE TABLE t1 (a int );
CREATE TABLE t2 LIKE t1;
@@ -315,3 +343,87 @@ DROP DATABASE testdb7;
DROP DATABASE testdb8;
DROP DATABASE testdb9;
DROP DATABASE testdb10;
+create table t1(a int, b int, c int, d int);
+grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
+show grants for grant_user@localhost;
+Grants for grant_user@localhost
+GRANT USAGE ON *.* TO 'grant_user'@'localhost'
+GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+Host Db User Table_name Column_name Column_priv
+localhost test grant_user t1 c Insert
+localhost test grant_user t1 b Insert
+localhost test grant_user t1 a Insert
+localhost test grant_user t1 d Insert
+revoke ALL PRIVILEGES on t1 from grant_user@localhost;
+show grants for grant_user@localhost;
+Grants for grant_user@localhost
+GRANT USAGE ON *.* TO 'grant_user'@'localhost'
+select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
+Host Db User Table_name Column_name Column_priv
+drop user grant_user@localhost;
+drop table t1;
+create database mysqltest_1;
+create database mysqltest_2;
+create table mysqltest_1.t1 select 1 a, 2 q;
+create table mysqltest_1.t2 select 1 b, 2 r;
+create table mysqltest_2.t1 select 1 c, 2 s;
+create table mysqltest_2.t2 select 1 d, 2 t;
+grant update (a) on mysqltest_1.t1 to mysqltest_3@localhost;
+grant select (b) on mysqltest_1.t2 to mysqltest_3@localhost;
+grant select (c) on mysqltest_2.t1 to mysqltest_3@localhost;
+grant update (d) on mysqltest_2.t2 to mysqltest_3@localhost;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+GRANT SELECT (b) ON `mysqltest_1`.`t2` TO 'mysqltest_3'@'localhost'
+GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
+GRANT UPDATE (a) ON `mysqltest_1`.`t1` TO 'mysqltest_3'@'localhost'
+GRANT UPDATE (d) ON `mysqltest_2`.`t2` TO 'mysqltest_3'@'localhost'
+update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
+update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2'
+update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
+update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 's' in table 't1'
+update mysqltest_1.t1, mysqltest_2.t2 set a=10,d=10;
+update mysqltest_1.t1, mysqltest_2.t1 set a=20 where c=20;
+select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
+a q b r
+10 2 1 2
+select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
+c s d t
+1 2 10 2
+revoke all on mysqltest_1.t1 from mysqltest_3@localhost;
+revoke all on mysqltest_1.t2 from mysqltest_3@localhost;
+revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
+revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
+grant all on mysqltest_2.* to mysqltest_3@localhost;
+grant select on *.* to mysqltest_3@localhost;
+flush privileges;
+use mysqltest_1;
+update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
+update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
+ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'a' in table 't1'
+use mysqltest_2;
+update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
+update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
+update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
+ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
+select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
+a q b r
+10 2 1 2
+select t1.*,t2.* from mysqltest_2.t1,mysqltest_2.t2;
+c s d t
+500 2 600 2
+delete from mysql.user where user='mysqltest_3';
+delete from mysql.db where user="mysqltest_3";
+delete from mysql.tables_priv where user="mysqltest_3";
+delete from mysql.columns_priv where user="mysqltest_3";
+flush privileges;
+drop database mysqltest_1;
+drop database mysqltest_2;
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index a31fa2ac3dc..6d8bdbaf8f9 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -37,7 +37,6 @@ show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
GRANT SELECT, INSERT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
-use mysqltest;
insert into t1 values (1, 'I can''t change it!');
update t1 set data='I can change it!' where id = 1;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
@@ -47,8 +46,20 @@ select * from t1;
id data
1 I can't change it!
drop table t1;
-drop database mysqltest;
-use test;
delete from mysql.user where user like 'mysqltest\_%';
delete from mysql.db where user like 'mysqltest\_%';
flush privileges;
+create table t1 (a int, b int);
+grant select (a) on t1 to mysqltest_1@localhost with grant option;
+grant select (a,b) on t1 to mysqltest_2@localhost;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1'
+grant select on t1 to mysqltest_3@localhost;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
+drop table t1;
+delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
+delete from mysql.columns_priv where user like 'mysqltest\_%';
+flush privileges;
+drop database mysqltest;
+use test;
diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result
index 892f1d940a6..d905e9319fd 100644
--- a/mysql-test/r/grant_cache.result
+++ b/mysql-test/r/grant_cache.result
@@ -134,7 +134,7 @@ a b c a
1 1 1 test.t1
2 2 2 test.t1
select * from t2;
-ERROR 42000: select command denied to user 'mysqltest_2'@'localhost' for table 't2'
+ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 't2'
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 6
@@ -148,7 +148,7 @@ select "user3";
user3
user3
select * from t1;
-ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'b' in table 't1'
select a from t1;
a
1
@@ -156,7 +156,7 @@ a
select c from t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
select * from t2;
-ERROR 42000: select command denied to user 'mysqltest_3'@'localhost' for table 't2'
+ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't2'
select mysqltest.t1.c from test.t1,mysqltest.t1;
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
show status like "Qcache_queries_in_cache";
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 022b8eff7e8..7f365eac58a 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -629,6 +629,18 @@ explain SELECT i, COUNT(DISTINCT(i)) FROM t1 GROUP BY j ORDER BY NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
DROP TABLE t1;
+create table t1 (a int);
+insert into t1 values(null);
+select min(a) is null from t1;
+min(a) is null
+1
+select min(a) is null or null from t1;
+min(a) is null or null
+1
+select 1 and min(a) is null from t1;
+1 and min(a) is null
+1
+drop table t1;
create table t1 ( col1 int, col2 int );
insert into t1 values (1,1),(1,2),(1,3),(2,1),(2,2);
select group_concat( distinct col1 ) as alias from t1
@@ -638,3 +650,30 @@ alias
1,2
1
drop table t1;
+create table t1 (a integer, b integer, c integer);
+insert into t1 (a,b) values (1,2),(1,3),(2,5);
+select a, 0.1*0+1 r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2=1;
+a r2 r1
+1 1.0 2
+select a, round(rand(100)*10) r2, sum(1) r1 from t1 where a = 1 group by a having r1>1 and r2<=2;
+a r2 r1
+1 2 2
+select a,sum(b) from t1 where a=1 group by c;
+a sum(b)
+1 5
+select a*sum(b) from t1 where a=1 group by c;
+a*sum(b)
+5
+select sum(a)*sum(b) from t1 where a=1 group by c;
+sum(a)*sum(b)
+10
+select a,sum(b) from t1 where a=1 group by c having a=1;
+a sum(b)
+1 5
+select a as d,sum(b) from t1 where a=1 group by c having d=1;
+d sum(b)
+1 5
+select sum(a)*sum(b) as d from t1 where a=1 group by c having d > 0;
+d
+10
+drop table t1;
diff --git a/mysql-test/r/have_exampledb.require b/mysql-test/r/have_exampledb.require
index 4b0938660fe..29d0cf8b1a6 100644
--- a/mysql-test/r/have_exampledb.require
+++ b/mysql-test/r/have_exampledb.require
@@ -1,2 +1,2 @@
Variable_name Value
-have_exampledb YES
+have_example_engine YES
diff --git a/mysql-test/r/have_moscow_leap_timezone.require b/mysql-test/r/have_moscow_leap_timezone.require
new file mode 100644
index 00000000000..f27452d7770
--- /dev/null
+++ b/mysql-test/r/have_moscow_leap_timezone.require
@@ -0,0 +1,2 @@
+from_unixtime(1072904422)
+2004-01-01 00:00:00
diff --git a/mysql-test/r/have_openssl_1.require b/mysql-test/r/have_openssl_1.require
index 032b60d544a..b33a1d2854f 100644
--- a/mysql-test/r/have_openssl_1.require
+++ b/mysql-test/r/have_openssl_1.require
@@ -1,2 +1,2 @@
Variable_name Value
-Ssl_cipher EDH-RSA-DES-CBC3-SHA
+Ssl_cipher DHE-RSA-AES256-SHA
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 92b694b5117..b1cd17b444c 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -4,7 +4,7 @@ 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
+t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1;
a b
2 2
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
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 Using where
+1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ 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 Using where
+1 SIMPLE t1 ref a a 5 const 1 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -204,7 +204,7 @@ key a (a)
INSERT INTO t1 VALUES (10), (10), (10);
EXPLAIN SELECT * FROM t1 WHERE a=10;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 ref a a 5 const 10 Using where
+1 SIMPLE t1 ref a a 5 const 3 Using where
SELECT * FROM t1 WHERE a=10;
a
10
@@ -233,3 +233,19 @@ SELECT * FROM t1 WHERE B is not null;
a B
1 1
DROP TABLE t1;
+CREATE TABLE t1 (pseudo char(35) PRIMARY KEY, date int(10) unsigned NOT NULL) ENGINE=HEAP;
+INSERT INTO t1 VALUES ('massecot',1101106491),('altec',1101106492),('stitch+',1101106304),('Seb Corgan',1101106305),('beerfilou',1101106263),('flaker',1101106529),('joce8',5),('M4vrick',1101106418),('gabay008',1101106525),('Vamp irX',1101106291),('ZoomZip',1101106546),('rip666',1101106502),('CBP ',1101106397),('guezpard',1101106496);
+DELETE FROM t1 WHERE date<1101106546;
+SELECT * FROM t1;
+pseudo date
+ZoomZip 1101106546
+DROP TABLE t1;
+create table t1(a char(2)) engine=memory;
+insert into t1 values (NULL), (NULL);
+delete from t1 where a is null;
+insert into t1 values ('2'), ('3');
+select * from t1;
+a
+3
+2
+drop table t1;
diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result
index 7affbf788fb..d3673cd2a63 100644
--- a/mysql-test/r/heap_hash.result
+++ b/mysql-test/r/heap_hash.result
@@ -1,10 +1,10 @@
-drop table if exists t1;
+drop table if exists t1,t2;
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=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
+t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
select * from t1;
a b
2 2
@@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
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 Using where
+1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
@@ -182,7 +182,7 @@ 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 Using where
+1 SIMPLE t1 ref a a 5 const 1 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
@@ -203,3 +203,165 @@ DELETE from t1 where a < 100;
SELECT * from t1;
a
DROP TABLE t1;
+create table t1
+(
+a char(8) not null,
+b char(20) not null,
+c int not null,
+key (a)
+) engine=heap;
+insert into t1 values ('aaaa', 'prefill-hash=5',0);
+insert into t1 values ('aaab', 'prefill-hash=0',0);
+insert into t1 values ('aaac', 'prefill-hash=7',0);
+insert into t1 values ('aaad', 'prefill-hash=2',0);
+insert into t1 values ('aaae', 'prefill-hash=1',0);
+insert into t1 values ('aaaf', 'prefill-hash=4',0);
+insert into t1 values ('aaag', 'prefill-hash=3',0);
+insert into t1 values ('aaah', 'prefill-hash=6',0);
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+insert into t1 select * from t1;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+flush tables;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 2 Using where
+create table t2 as select * from t1;
+delete from t1;
+insert into t1 select * from t2;
+explain select * from t1 where a='aaaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaab';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaac';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+explain select * from t1 where a='aaad';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 8 const 1 Using where
+drop table t1, t2;
+create table t1 (
+id int unsigned not null primary key auto_increment,
+name varchar(20) not null,
+index heap_idx(name),
+index btree_idx using btree(name)
+) engine=heap;
+create table t2 (
+id int unsigned not null primary key auto_increment,
+name varchar(20) not null,
+index btree_idx using btree(name),
+index heap_idx(name)
+) engine=heap;
+insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
+('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
+('Emily'), ('Mike');
+insert into t2 select * from t1;
+explain select * from t1 where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Phil';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Phil';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+explain select * from t1 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
+explain select * from t2 where name='Lilu';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+insert into t1 (name) select name from t2;
+flush tables;
+select count(*) from t1 where name='Matt';
+count(*)
+7
+explain select * from t1 ignore index (btree_idx) where name='matt';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
+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 id NULL 91 NULL NULL HASH
+t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
+t1 1 btree_idx 1 name A NULL NULL NULL BTREE
+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 id NULL 91 NULL NULL HASH
+t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
+t1 1 btree_idx 1 name A NULL NULL NULL BTREE
+create table t3
+(
+a varchar(20) not null,
+b varchar(20) not null,
+key (a,b)
+) engine=heap;
+insert into t3 select name, name from t1;
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a NULL NULL NULL NULL HASH
+t3 1 a 2 b NULL 15 NULL NULL HASH
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a NULL NULL NULL NULL HASH
+t3 1 a 2 b NULL 15 NULL NULL HASH
+explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
+1 SIMPLE t3 ref a a 40 func,const 6 Using where
+drop table t1, t2, t3;
+create temporary table t1 ( a int, index (a) ) engine=memory;
+insert into t1 values (1),(2),(3),(4),(5);
+select a from t1 where a in (1,3);
+a
+1
+3
+explain select a from t1 where a in (1,3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 5 NULL 2 Using where
+drop table t1;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 9d830367745..009432ec3ab 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -1630,3 +1630,21 @@ show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
drop table t1;
+create table t1 (c char(10), index (c,c)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/innodb.result.es b/mysql-test/r/innodb.result.es
new file mode 100644
index 00000000000..602a034bc16
--- /dev/null
+++ b/mysql-test/r/innodb.result.es
@@ -0,0 +1,1653 @@
+drop table if exists t1,t2,t3,t4;
+drop database if exists mysqltest;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
+select id, code, name from t1 order by id;
+id code name
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
+select id, code, name from t1 order by id;
+id code name
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+8 1 Sinisa
+12 1 Ralph
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+PRIMARY KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+Got one of the listed errors
+select * from t1;
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1009 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1022 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1038 107 2
+1040 107 2
+1157 100 0
+1179 105 2
+1183 104 2
+1193 105 2
+1202 107 2
+1203 107 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1001 100 0
+1002 101 1
+1003 101 1
+1004 101 1
+1005 101 1
+1006 101 1
+1007 101 1
+1008 102 2
+1010 102 2
+1015 102 2
+1016 103 2
+1017 103 2
+1018 103 2
+1019 103 2
+1020 103 2
+1021 104 2
+1023 104 2
+1024 104 2
+1025 105 2
+1026 105 2
+1027 105 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1034 106 2
+1035 106 2
+1036 107 2
+1037 107 2
+1039 107 2
+1041 107 2
+1158 100 0
+1180 105 2
+1184 104 2
+1194 105 2
+1202 107 2
+1204 107 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1008 102 2
+1010 102 2
+1015 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+explain select level,id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+explain select level,id,parent_id from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where
+select level,id from t1 where level=1;
+level id
+1 1002
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1002 101
+1 1003 101
+1 1004 101
+1 1005 101
+1 1006 101
+1 1007 101
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+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 id A # NULL NULL BTREE
+t1 1 parent_id 1 parent_id A # NULL NULL BTREE
+t1 1 level 1 level A # NULL NULL BTREE
+drop table t1;
+CREATE TABLE t1 (
+gesuchnr int(11) DEFAULT '0' NOT NULL,
+benutzer_id int(11) DEFAULT '0' NOT NULL,
+PRIMARY KEY (gesuchnr,benutzer_id)
+) engine=innodb;
+replace into t1 (gesuchnr,benutzer_id) values (2,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+replace into t1 (gesuchnr,benutzer_id) values (1,1);
+select * from t1;
+gesuchnr benutzer_id
+1 1
+2 1
+drop table t1;
+create table t1 (a int) engine=innodb;
+insert into t1 values (1), (2);
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+delete from t1 where a = 1;
+select * from t1;
+a
+2
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
+create table t1 (a int,b varchar(20)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+delete from t1 where a = 1;
+select * from t1;
+a b
+2 testing
+create index skr on t1 (a);
+insert into t1 values (3,""), (4,"testing");
+analyze table t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+show keys from t1;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t1 1 skr 1 a A # NULL NULL YES BTREE
+drop table t1;
+create table t1 (a int,b varchar(20),key(a)) engine=innodb;
+insert into t1 values (1,""), (2,"testing");
+select * from t1 where a = 1;
+a b
+1
+drop table t1;
+create table t1 (n int not null primary key) engine=innodb;
+set autocommit=0;
+insert into t1 values (4);
+rollback;
+select n, "after rollback" from t1;
+n after rollback
+insert into t1 values (4);
+commit;
+select n, "after commit" from t1;
+n after commit
+4 after commit
+commit;
+insert into t1 values (5);
+insert into t1 values (4);
+ERROR 23000: Duplicate entry '4' for key 1
+commit;
+select n, "after commit" from t1;
+n after commit
+4 after commit
+5 after commit
+set autocommit=1;
+insert into t1 values (6);
+insert into t1 values (4);
+ERROR 23000: Duplicate entry '4' for key 1
+select n from t1;
+n
+4
+5
+6
+rollback;
+drop table t1;
+create table t1 (n int not null primary key) engine=innodb;
+start transaction;
+insert into t1 values (4);
+flush tables with read lock;
+commit;
+unlock tables;
+commit;
+select * from t1;
+n
+4
+drop table t1;
+create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
+begin;
+insert into t1 values(1,'hamdouni');
+select id as afterbegin_id,nom as afterbegin_nom from t1;
+afterbegin_id afterbegin_nom
+1 hamdouni
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+afterrollback_id afterrollback_nom
+set autocommit=0;
+insert into t1 values(2,'mysql');
+select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
+afterautocommit0_id afterautocommit0_nom
+2 mysql
+rollback;
+select id as afterrollback_id,nom as afterrollback_nom from t1;
+afterrollback_id afterrollback_nom
+set autocommit=1;
+drop table t1;
+CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
+insert into t1 values ('pippo', 12);
+insert into t1 values ('pippo', 12);
+ERROR 23000: Duplicate entry 'pippo' for key 1
+delete from t1;
+delete from t1 where id = 'pippo';
+select * from t1;
+id val
+insert into t1 values ('pippo', 12);
+set autocommit=0;
+delete from t1;
+rollback;
+select * from t1;
+id val
+pippo 12
+delete from t1;
+commit;
+select * from t1;
+id val
+drop table t1;
+create table t1 (a integer) engine=innodb;
+start transaction;
+rename table t1 to t2;
+create table t1 (b integer) engine=innodb;
+insert into t1 values (1);
+rollback;
+drop table t1;
+rename table t2 to t1;
+drop table t1;
+set autocommit=1;
+CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
+INSERT INTO t1 VALUES (1, 'Jochen');
+select * from t1;
+ID NAME
+1 Jochen
+drop table t1;
+CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
+set autocommit=0;
+INSERT INTO t1 SET _userid='marc@anyware.co.uk';
+COMMIT;
+SELECT * FROM t1;
+_userid
+marc@anyware.co.uk
+SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
+_userid
+marc@anyware.co.uk
+drop table t1;
+set autocommit=1;
+CREATE TABLE t1 (
+user_id int(10) DEFAULT '0' NOT NULL,
+name varchar(100),
+phone varchar(100),
+ref_email varchar(100) DEFAULT '' NOT NULL,
+detail varchar(200),
+PRIMARY KEY (user_id,ref_email)
+)engine=innodb;
+INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
+select * from t1 where user_id=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+select * from t1 where user_id>=10292;
+user_id name phone ref_email detail
+10292 sanjeev 29153373 sansh777@hotmail.com xxx
+10292 shirish 2333604 shirish@yahoo.com ddsds
+10292 sonali 323232 sonali@bolly.com filmstar
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id>10292;
+user_id name phone ref_email detail
+10293 shirish 2333604 shirish@yahoo.com ddsds
+select * from t1 where user_id<10292;
+user_id name phone ref_email detail
+10291 sanjeev 29153373 sansh777@hotmail.com xxx
+drop table t1;
+CREATE TABLE t1 (a int not null, b int not null,c int not null,
+key(a),primary key(a,b), unique(c),key(a),unique(b));
+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 # NULL NULL BTREE
+t1 0 PRIMARY 2 b A # NULL NULL BTREE
+t1 0 c 1 c A # NULL NULL BTREE
+t1 0 b 1 b A # NULL NULL BTREE
+t1 1 a 1 a A # NULL NULL BTREE
+t1 1 a_2 1 a A # NULL NULL BTREE
+drop table t1;
+create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
+alter table t1 engine=innodb;
+insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
+select * from t1;
+col1 col2
+1 1
+2 3
+3 4
+4 4
+5 2
+update t1 set col2='7' where col1='4';
+select * from t1;
+col1 col2
+1 1
+2 3
+3 4
+4 7
+5 2
+alter table t1 add co3 int not null;
+select * from t1;
+col1 col2 co3
+1 1 0
+2 3 0
+3 4 0
+4 7 0
+5 2 0
+update t1 set col2='9' where col1='2';
+select * from t1;
+col1 col2 co3
+1 1 0
+2 9 0
+3 4 0
+4 7 0
+5 2 0
+drop table t1;
+create table t1 (a int not null , b int, primary key (a)) engine = innodb;
+create table t2 (a int not null , b int, primary key (a)) engine = myisam;
+insert into t1 VALUES (1,3) , (2,3), (3,3);
+select * from t1;
+a b
+1 3
+2 3
+3 3
+insert into t2 select * from t1;
+select * from t2;
+a b
+1 3
+2 3
+3 3
+delete from t1 where b = 3;
+select * from t1;
+a b
+insert into t1 select * from t2;
+select * from t1;
+a b
+1 3
+2 3
+3 3
+select * from t2;
+a b
+1 3
+2 3
+3 3
+drop table t1,t2;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+ggid varchar(32) binary DEFAULT '' NOT NULL,
+email varchar(64) DEFAULT '' NOT NULL,
+passwd varchar(32) binary DEFAULT '' NOT NULL,
+PRIMARY KEY (id),
+UNIQUE ggid (ggid)
+) ENGINE=innodb;
+insert into t1 (ggid,passwd) values ('test1','xxx');
+insert into t1 (ggid,passwd) values ('test2','yyy');
+insert into t1 (ggid,passwd) values ('test2','this will fail');
+ERROR 23000: Duplicate entry 'test2' for key 2
+insert into t1 (ggid,id) values ('this will fail',1);
+ERROR 23000: Duplicate entry '1' for key 1
+select * from t1 where ggid='test1';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where passwd='xxx';
+id ggid email passwd
+1 test1 xxx
+select * from t1 where id=2;
+id ggid email passwd
+2 test2 yyy
+replace into t1 (ggid,id) values ('this will work',1);
+replace into t1 (ggid,passwd) values ('test2','this will work');
+update t1 set id=100,ggid='test2' where id=1;
+ERROR 23000: Duplicate entry 'test2' for key 2
+select * from t1;
+id ggid email passwd
+1 this will work
+3 test2 this will work
+select * from t1 where id=1;
+id ggid email passwd
+1 this will work
+select * from t1 where id=999;
+id ggid email passwd
+drop table t1;
+CREATE TABLE t1 (
+user_name varchar(12),
+password text,
+subscribed char(1),
+user_id int(11) DEFAULT '0' NOT NULL,
+quota bigint(20),
+weight double,
+access_date date,
+access_time time,
+approved datetime,
+dummy_primary_key int(11) NOT NULL auto_increment,
+PRIMARY KEY (dummy_primary_key)
+) ENGINE=innodb;
+INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
+INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
+INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
+INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
+INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
+select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
+user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
+user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
+user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
+user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
+user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
+user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+parent_id int(11) DEFAULT '0' NOT NULL,
+level tinyint(4) DEFAULT '0' NOT NULL,
+KEY (id),
+KEY parent_id (parent_id),
+KEY level (level)
+) engine=innodb;
+INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
+INSERT INTO t1 values (179,5,2);
+update t1 set parent_id=parent_id+100;
+select * from t1 where parent_id=102;
+id parent_id level
+8 102 2
+9 102 2
+15 102 2
+update t1 set id=id+1000;
+update t1 set id=1024 where id=1009;
+select * from t1;
+id parent_id level
+1001 100 0
+1003 101 1
+1004 101 1
+1008 102 2
+1024 102 2
+1017 103 2
+1022 104 2
+1024 104 2
+1028 105 2
+1029 105 2
+1030 105 2
+1031 106 2
+1032 106 2
+1033 106 2
+1203 107 2
+1202 107 2
+1020 103 2
+1157 100 0
+1193 105 2
+1040 107 2
+1002 101 1
+1015 102 2
+1006 101 1
+1034 106 2
+1035 106 2
+1016 103 2
+1007 101 1
+1036 107 2
+1018 103 2
+1026 105 2
+1027 105 2
+1183 104 2
+1038 107 2
+1025 105 2
+1037 107 2
+1021 104 2
+1019 103 2
+1005 101 1
+1179 105 2
+update ignore t1 set id=id+1;
+select * from t1;
+id parent_id level
+1002 100 0
+1004 101 1
+1005 101 1
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1003 101 1
+1016 102 2
+1007 101 1
+1035 106 2
+1036 106 2
+1017 103 2
+1008 101 1
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1006 101 1
+1180 105 2
+update ignore t1 set id=1023 where id=1010;
+select * from t1 where parent_id=102;
+id parent_id level
+1009 102 2
+1025 102 2
+1016 102 2
+explain select level from t1 where level=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref level level 1 const # Using where; Using index
+select level,id from t1 where level=1;
+level id
+1 1004
+1 1005
+1 1003
+1 1007
+1 1008
+1 1006
+select level,id,parent_id from t1 where level=1;
+level id parent_id
+1 1004 101
+1 1005 101
+1 1003 101
+1 1007 101
+1 1008 101
+1 1006 101
+select level,id from t1 where level=1 order by id;
+level id
+1 1003
+1 1004
+1 1005
+1 1006
+1 1007
+1 1008
+delete from t1 where level=1;
+select * from t1;
+id parent_id level
+1002 100 0
+1009 102 2
+1025 102 2
+1018 103 2
+1023 104 2
+1025 104 2
+1029 105 2
+1030 105 2
+1031 105 2
+1032 106 2
+1033 106 2
+1034 106 2
+1204 107 2
+1203 107 2
+1021 103 2
+1158 100 0
+1194 105 2
+1041 107 2
+1016 102 2
+1035 106 2
+1036 106 2
+1017 103 2
+1037 107 2
+1019 103 2
+1027 105 2
+1028 105 2
+1184 104 2
+1039 107 2
+1026 105 2
+1038 107 2
+1022 104 2
+1020 103 2
+1180 105 2
+drop table t1;
+CREATE TABLE t1 (
+sca_code char(6) NOT NULL,
+cat_code char(6) NOT NULL,
+sca_desc varchar(50),
+lan_code char(2) NOT NULL,
+sca_pic varchar(100),
+sca_sdesc varchar(50),
+sca_sch_desc varchar(16),
+PRIMARY KEY (sca_code, cat_code, lan_code),
+INDEX sca_pic (sca_pic)
+) engine = innodb ;
+INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
+select count(*) from t1 where sca_code = 'PD';
+count(*)
+1
+select count(*) from t1 where sca_code <= 'PD';
+count(*)
+1
+select count(*) from t1 where sca_pic is null;
+count(*)
+2
+alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where cat_code='E';
+count(*)
+0
+alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
+select count(*) from t1 where sca_code='PD' and sca_pic is null;
+count(*)
+1
+select count(*) from t1 where sca_pic >= 'n';
+count(*)
+1
+select sca_pic from t1 where sca_pic is null;
+sca_pic
+NULL
+NULL
+update t1 set sca_pic="test" where sca_pic is null;
+delete from t1 where sca_code='pd';
+drop table t1;
+set @a:=now();
+CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
+insert into t1 (a) values(1),(2),(3);
+select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
+a
+1
+2
+3
+update t1 set a=5 where a=1;
+select a from t1;
+a
+2
+3
+5
+drop table t1;
+create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
+insert into t1 values("hello",1),("world",2);
+select * from t1 order by b desc;
+a b
+world 2
+hello 1
+optimize table t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+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 BTREE
+drop table t1;
+create table t1 (i int, j int ) ENGINE=innodb;
+insert into t1 values (1,2);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+create index ax1 on t1 (i,j);
+select * from t1 where i=1 and j=2;
+i j
+1 2
+drop table t1;
+CREATE TABLE t1 (
+a int3 unsigned NOT NULL,
+b int1 unsigned NOT NULL,
+UNIQUE (a, b)
+) ENGINE = innodb;
+INSERT INTO t1 VALUES (1, 1);
+SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
+MIN(B) MAX(b)
+1 1
+drop table t1;
+CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
+INSERT INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+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) engine = 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;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # 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)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 1
+select id from t1;
+id
+0
+1
+2
+select id from t1;
+id
+0
+1
+2
+UNLOCK TABLES;
+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)) engine=innodb;
+insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
+LOCK TABLES t1 WRITE;
+begin;
+insert into t1 values (99,1,2,'D'),(1,1,2,'D');
+ERROR 23000: Duplicate entry '1-1' for key 1
+select id from t1;
+id
+0
+1
+2
+insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
+commit;
+select id,id3 from t1;
+id id3
+0 0
+1 1
+2 2
+100 2
+UNLOCK TABLES;
+DROP TABLE t1;
+create table t1 (a char(20), unique (a(5))) engine=innodb;
+drop table t1;
+create table t1 (a char(20), index (a(5))) engine=innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(20) default NULL,
+ KEY `a` (`a`(5))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t1;
+create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
+insert into t1 values (NULL),(NULL),(NULL);
+delete from t1 where a=3;
+insert into t1 values (NULL);
+select * from t1;
+a
+1
+2
+4
+alter table t1 add b int;
+select * from t1;
+a b
+1 NULL
+2 NULL
+4 NULL
+drop table t1;
+create table t1
+(
+id int auto_increment primary key,
+name varchar(32) not null,
+value text not null,
+uid int not null,
+unique key(name,uid)
+) engine=innodb;
+insert into t1 values (1,'one','one value',101),
+(2,'two','two value',102),(3,'three','three value',103);
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+delete from t1 where uid=102;
+set insert_id=5;
+replace into t1 (value,name,uid) values ('other value','two',102);
+set insert_id=6;
+replace into t1 (value,name,uid) values ('other value','two',102);
+select * from t1;
+id name value uid
+1 one one value 101
+3 three three value 103
+6 two other value 102
+drop table t1;
+create database mysqltest;
+create table mysqltest.t1 (a int not null) engine= innodb;
+insert into mysqltest.t1 values(1);
+create table mysqltest.t2 (a int not null) engine= myisam;
+insert into mysqltest.t2 values(1);
+create table mysqltest.t3 (a int not null) engine= heap;
+insert into mysqltest.t3 values(1);
+commit;
+drop database mysqltest;
+show tables from mysqltest;
+Got one of the listed errors
+set autocommit=0;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+commit;
+truncate table t1;
+select * from t1;
+a
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+commit;
+drop table t1;
+set autocommit=1;
+create table t1 (a int not null) engine= innodb;
+insert into t1 values(1),(2);
+truncate table t1;
+insert into t1 values(1),(2);
+select * from t1;
+a
+1
+2
+truncate table t1;
+insert into t1 values(1),(2);
+delete from t1;
+select * from t1;
+a
+drop table t1;
+create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
+insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
+explain select * from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL #
+explain select * from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL #
+explain select * from t1 order by c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
+explain select a from t1 order by a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
+explain select b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1 order by b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL b 4 NULL # Using index
+explain select a,b,c from t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL #
+drop table t1;
+create table t1 (t int not null default 1, key (t)) engine=innodb;
+desc t1;
+Field Type Null Key Default Extra
+t int(11) MUL 1
+drop table t1;
+CREATE TABLE t1 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp(14) NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp(14) NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
+INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
+INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
+INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
+INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
+INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
+CREATE TABLE t2 (
+number bigint(20) NOT NULL default '0',
+cname char(15) NOT NULL default '',
+carrier_id smallint(6) NOT NULL default '0',
+privacy tinyint(4) NOT NULL default '0',
+last_mod_date timestamp(14) NOT NULL,
+last_mod_id smallint(6) NOT NULL default '0',
+last_app_date timestamp(14) NOT NULL,
+last_app_id smallint(6) default '-1',
+version smallint(6) NOT NULL default '0',
+assigned_scps int(11) default '0',
+status tinyint(4) default '0'
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
+INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
+INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
+INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
+302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
+9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
+650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
+select * from t1;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
+333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+select * from t2;
+number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
+333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
+drop table t1,t2;
+create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
+SELECT @@tx_isolation,@@global.tx_isolation;
+@@tx_isolation @@global.tx_isolation
+SERIALIZABLE REPEATABLE-READ
+insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+COMMIT;
+BEGIN;
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
+select id, code, name from t1 order by id;
+id code name
+1 1 Tim
+2 1 Monty
+3 2 David
+4 2 Erik
+5 3 Sasha
+6 3 Jeremy
+7 4 Matt
+COMMIT;
+DROP TABLE t1;
+create table t1 (n int(10), d int(10)) engine=innodb;
+create table t2 (n int(10), d int(10)) engine=innodb;
+insert into t1 values(1,1),(1,2);
+insert into t2 values(1,10),(2,20);
+UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
+select * from t1;
+n d
+1 10
+1 10
+select * from t2;
+n d
+1 30
+2 20
+drop table t1,t2;
+create table t1 (a int, b int) engine=innodb;
+insert into t1 values(20,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a;
+b ifnull(t2.b,"this is null")
+NULL this is null
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+insert into t1 values(10,null);
+select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
+t2.b=t3.a order by 1;
+b ifnull(t2.b,"this is null")
+NULL this is null
+NULL this is null
+drop table t1;
+create table t1 (a varchar(10) not null) engine=myisam;
+create table t2 (b varchar(10) not null unique) engine=innodb;
+select t1.a from t1,t2 where t1.a=t2.b;
+a
+drop table t1,t2;
+create table t1 (a int not null, b int, primary key (a)) engine = innodb;
+create table t2 (a int not null, b int, primary key (a)) engine = innodb;
+insert into t1 values (10, 20);
+insert into t2 values (10, 20);
+update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
+drop table t1,t2;
+CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
+insert into t1 set id=1;
+insert into t2 set id=1, t1_id=1;
+delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
+select * from t1;
+id
+select * from t2;
+id t1_id
+drop table t2,t1;
+CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2 VALUES(1, 1);
+SELECT * from t1;
+id
+1
+UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
+SELECT * from t1;
+id
+2
+UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
+SELECT * from t1;
+id
+3
+DROP TABLE t1,t2;
+set autocommit=0;
+CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
+CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
+INSERT INTO t3 VALUES("my-test-1", "my-test-2");
+COMMIT;
+INSERT INTO t1 VALUES("this-key", "will disappear");
+INSERT INTO t2 VALUES("this-key", "will also disappear");
+DELETE FROM t3 WHERE id1="my-test-1";
+SELECT * FROM t1;
+id value
+this-key will disappear
+SELECT * FROM t2;
+id value
+this-key will also disappear
+SELECT * FROM t3;
+id1 id2
+ROLLBACK;
+SELECT * FROM t1;
+id value
+SELECT * FROM t2;
+id value
+SELECT * FROM t3;
+id1 id2
+my-test-1 my-test-2
+SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
+id1 id2
+my-test-1 my-test-2
+COMMIT;
+set autocommit=1;
+DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
+SELECT * from t1;
+a b
+1 1
+102 2
+103 3
+4 4
+5 5
+6 6
+7 7
+8 8
+9 9
+drop table t1;
+CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update t1,t2 set t1.a=t1.a+100;
+select * from t1;
+a b
+101 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.a=t1.a+100 where t1.a=101;
+select * from t1;
+a b
+201 1
+102 2
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+112 12
+update t1,t2 set t1.b=t1.b+10 where t1.b=2;
+select * from t1;
+a b
+201 1
+103 3
+104 4
+105 5
+106 6
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
+select * from t1;
+a b
+201 1
+103 5
+104 6
+106 6
+105 7
+107 7
+108 8
+109 9
+110 10
+111 11
+102 12
+112 12
+select * from t2;
+a b
+1 1
+2 2
+6 6
+7 7
+8 8
+9 9
+3 13
+4 14
+5 15
+drop table t1,t2;
+CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
+CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
+SET AUTOCOMMIT=0;
+INSERT INTO t1 ( B_ID ) VALUES ( 1 );
+INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
+ROLLBACK;
+Warnings:
+Warning 1196 Some non-transactional changed tables couldn't be rolled back
+SELECT * FROM t1;
+B_ID
+drop table t1,t2;
+create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
+insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
+select distinct parent,child from t1 order by parent;
+parent child
+0 4
+1 2
+1 3
+2 1
+drop table t1;
+create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
+create table t2 (a int not null auto_increment primary key, b int);
+insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
+insert into t2 (a) select b from t1;
+insert into t1 (b) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+insert into t2 (a) select b from t1;
+insert into t1 (a) select b from t2;
+select count(*) from t1;
+count(*)
+29267
+explain select * from t1 where c between 1 and 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c c 5 NULL # Using where
+update t1 set c=a;
+explain select * from t1 where c between 1 and 10000;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL c NULL NULL NULL # Using where
+drop table t1,t2;
+create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
+insert into t1 (id) values (null),(null),(null),(null),(null);
+update t1 set fk=69 where fk is null order by id limit 1;
+SELECT * from t1;
+id fk
+2 NULL
+3 NULL
+4 NULL
+5 NULL
+1 69
+drop table t1;
+create table t1 (a int not null, b int not null, key (a));
+insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
+SET @tmp=0;
+update t1 set b=(@tmp:=@tmp+1) order by a;
+update t1 set b=99 where a=1 order by b asc limit 1;
+update t1 set b=100 where a=1 order by b desc limit 2;
+update t1 set a=a+10+b where a=1 order by b;
+select * from t1 order by a,b;
+a b
+2 4
+2 5
+2 6
+3 7
+3 8
+3 9
+3 10
+3 11
+3 12
+13 2
+111 100
+111 100
+drop table t1;
+create table t1 ( c char(8) not null ) engine=innodb;
+insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
+insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
+alter table t1 add b char(8) not null;
+alter table t1 add a char(8) not null;
+alter table t1 add primary key (a,b,c);
+update t1 set a=c, b=c;
+create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
+insert into t2 select * from t1;
+delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
+drop table t1,t2;
+SET AUTOCOMMIT=1;
+create table t1 (a integer auto_increment primary key) engine=innodb;
+insert into t1 (a) values (NULL),(NULL);
+truncate table t1;
+insert into t1 (a) values (NULL),(NULL);
+SELECT * from t1;
+a
+3
+4
+drop table t1;
+CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
+CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
+drop table t2,t1;
+create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
+insert into `t1`values ( 1 ) ;
+create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
+insert into `t2`values ( 1 ) ;
+create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
+insert into `t3`values ( 1 ) ;
+delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
+ERROR 42S02: Unknown table 't1' in where clause
+drop table t3,t2,t1;
+create table t1(
+id int primary key,
+pid int,
+index(pid),
+foreign key(pid) references t1(id) on delete cascade) engine=innodb;
+insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
+(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
+delete from t1 where id=0;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+delete from t1 where id=15;
+delete from t1 where id=0;
+drop table t1;
+CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
+CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
+(stamp))ENGINE=InnoDB;
+insert into t1 values (1),(2),(3);
+insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
+Warnings:
+Warning 1265 Data truncated for column 'stamp' at row 3
+SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
+'20020204120000' GROUP BY col1;
+col1
+1
+2
+3
+4
+drop table t1,t2;
+CREATE TABLE t1 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_object` int(10) unsigned default '0',
+`id_version` int(10) unsigned NOT NULL default '1',
+label varchar(100) NOT NULL default '',
+`description` text,
+PRIMARY KEY (`id`),
+KEY `id_object` (`id_object`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
+CREATE TABLE t2 (
+`id` int(10) unsigned NOT NULL auto_increment,
+`id_version` int(10) unsigned NOT NULL default '1',
+PRIMARY KEY (`id`),
+KEY `id_version` (`id_version`)
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
+SELECT t2.id, t1.label FROM t2 INNER JOIN
+(SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl
+ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
+id label
+3382 Test
+102 Le Pekin (Test)
+1794 Test de resto
+1822 Test 3
+3524 Societe Test
+3525 Fournisseur Test
+drop table t1,t2;
+create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb;
+select * from t1;
+c1 c2 stamp
+replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12");
+select * from t1;
+c1 c2 stamp
+text1 11 2004-12-01 13:23:14
+text2 12 2004-12-01 13:23:14
+replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" );
+ERROR 21S01: Column count doesn't match value count at row 3
+select * from t1;
+c1 c2 stamp
+text1 11 2004-12-01 13:23:14
+text2 12 2004-12-01 13:23:14
+drop table t1;
+create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
+create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
+create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
+insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
+insert t2 select * from t1;
+insert t3 select * from t1;
+checksum table t1, t2, t3, t4 quick;
+Table Checksum
+test.t1 968604391
+test.t2 NULL
+test.t3 NULL
+test.t4 NULL
+checksum table t1, t2, t3, t4;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+checksum table t1, t2, t3, t4 extended;
+Table Checksum
+test.t1 968604391
+test.t2 968604391
+test.t3 968604391
+test.t4 NULL
+drop table t1,t2,t3;
+create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
+insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
+select name2 from t1 union all select name from t1 union all select id from t1;
+name2
+fff
+sss
+ttt
+first
+second
+third
+1
+2
+3
+drop table t1;
+create table t1 (a int) engine=innodb;
+create table t2 like t1;
+drop table t1,t2;
+create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
+create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create index id2 on t2 (id);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ KEY `id2` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop index id2 on t2;
+drop index id on t2;
+Got one of the listed errors
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ KEY `id` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+create unique index id on t2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL default '0',
+ `id2` int(11) NOT NULL default '0',
+ UNIQUE KEY `id` (`id`,`id2`),
+ KEY `t1_id_fk` (`id2`,`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ PRIMARY KEY (`id`),
+ KEY `id` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `t1_id_fk` (`id`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+alter table t2 add index id_test (id), add index id_test2 (id,id2);
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL auto_increment,
+ `id2` int(11) NOT NULL default '0',
+ KEY `id_test` (`id`),
+ KEY `id_test2` (`id`,`id2`),
+ CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
+ERROR HY000: Can't create table '/home/hf/work/mysql-4.1.clean/mysql-test/var/master-data/test/t2.frm' (errno: 150)
+create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b_2` (`b`),
+ KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2;
+create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL auto_increment,
+ `b` int(11) default NULL,
+ PRIMARY KEY (`a`),
+ UNIQUE KEY `b` (`b`),
+ CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
+ CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+drop table t2, t1;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 24
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 0
+create table t1 (a int) engine=innodb;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 25
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+begin;
+delete from t1;
+commit;
+show status like "binlog_cache_use";
+Variable_name Value
+Binlog_cache_use 26
+show status like "binlog_cache_disk_use";
+Variable_name Value
+Binlog_cache_disk_use 1
+drop table t1;
+create table t1 (c char(10), index (c,c)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10)) engine=innodb;
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 7c7ac152aa5..f5ad0c87881 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -81,6 +81,15 @@ a
1
2
drop table t1, t2;
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+create table t2(unique(a)) select a from t1;
+ERROR 23000: Duplicate entry '1' for key 1
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
@@ -629,3 +638,15 @@ No Field Count
0 1 100
0 2 100
drop table t1, t2;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+NO int(11) NOT NULL default '0',
+SEQ int(11) NOT NULL default '0',
+PRIMARY KEY (ID),
+KEY t1$NO (SEQ,NO)
+) ENGINE=MyISAM;
+INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
+select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
+ID NO SEQ
+1 1 1
+drop table t1;
diff --git a/mysql-test/r/insert_select.result.es b/mysql-test/r/insert_select.result.es
index 3955c0534f2..9cac6d31b8f 100644
--- a/mysql-test/r/insert_select.result.es
+++ b/mysql-test/r/insert_select.result.es
@@ -78,6 +78,13 @@ a
1
2
drop table t1, t2;
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+create table t2(unique(a)) select a from t1;
+ERROR 23000: Duplicate entry '1' for key 1
+show binlog events;
+drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
@@ -626,3 +633,15 @@ No Field Count
0 1 100
0 2 100
drop table t1, t2;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+NO int(11) NOT NULL default '0',
+SEQ int(11) NOT NULL default '0',
+PRIMARY KEY (ID),
+KEY t1$NO (SEQ,NO)
+) ENGINE=MyISAM;
+INSERT INTO t1 (SEQ, NO) SELECT "1" AS SEQ, IF(MAX(NO) IS NULL, 0, MAX(NO)) + 1 AS NO FROM t1 WHERE (SEQ = 1);
+select SQL_BUFFER_RESULT * from t1 WHERE (SEQ = 1);
+ID NO SEQ
+1 1 1
+drop table t1;
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 303d7186015..ff7ec1ba73f 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -105,3 +105,65 @@ a b
8 28
9 29
drop table t1;
+CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B));
+INSERT t1 VALUES (1,2,10), (3,4,20);
+INSERT t1 SELECT 5,6,30 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 30
+INSERT t1 SELECT 5,7,40 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 20
+5 6 130
+INSERT t1 SELECT 8,4,50 FROM DUAL ON DUPLICATE KEY UPDATE c=c+1000;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 1020
+5 6 130
+INSERT t1 SELECT 1,4,60 FROM DUAL ON DUPLICATE KEY UPDATE c=c+10000;
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+INSERT t1 SELECT 1,9,70 FROM DUAL ON DUPLICATE KEY UPDATE c=c+100000, b=4;
+ERROR 23000: Duplicate entry '4' for key 2
+SELECT * FROM t1;
+a b c
+1 2 10010
+3 4 1020
+5 6 130
+TRUNCATE TABLE t1;
+INSERT t1 VALUES (1,2,10), (3,4,20);
+CREATE TABLE t2 (a INT, b INT, c INT, d INT);
+INSERT t2 VALUES (5,6,30,1), (7,4,40,1), (8,9,60,1);
+INSERT t2 VALUES (2,1,11,2), (7,4,40,2);
+INSERT t1 SELECT a,b,c FROM t2 WHERE d=1 ON DUPLICATE KEY UPDATE c=c+100;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 6 30
+8 9 60
+INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0;
+SELECT * FROM t1;
+a b c
+1 2 10
+3 4 120
+5 0 30
+8 9 60
+INSERT t1 SELECT a,b,c FROM t2 WHERE d=2 ON DUPLICATE KEY UPDATE c=c+VALUES(a);
+SELECT *, VALUES(a) FROM t1;
+a b c VALUES(a)
+1 2 10 NULL
+3 4 127 NULL
+5 0 30 NULL
+8 9 60 NULL
+2 1 11 NULL
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 75bf96cb401..c045aa0d00a 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -751,3 +751,68 @@ player_id match_1_h * match_id home UUX
7 4 * 1 2 2
3 3 * 1 2 1
drop table t1, t2;
+create table t1 (a int, b int, unique index idx (a, b));
+create table t2 (a int, b int, c int, unique index idx (a, b));
+insert into t1 values (1, 10), (1,11), (2,10), (2,11);
+insert into t2 values (1,10,3);
+select t1.a, t1.b, t2.c from t1 left join t2
+on t1.a=t2.a and t1.b=t2.b and t2.c=3
+where t1.a=1 and t2.c is null;
+a b c
+1 11 NULL
+drop table t1, t2;
+CREATE TABLE t1 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ts_id bigint(20) default NULL,
+inst_id tinyint(4) default NULL,
+flag_name varchar(64) default NULL,
+flag_value text,
+UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+INSERT INTO t1 VALUES
+(111056548820001, 0, 'flag1', NULL),
+(111056548820001, 0, 'flag2', NULL),
+(2, 0, 'other_flag', NULL);
+INSERT INTO t2 VALUES
+(111056548820001, 3, 'flag1', 'sss');
+SELECT t1.flag_name,t2.flag_value
+FROM t1 LEFT JOIN t2
+ON (t1.ts_id = t2.ts_id AND t1.flag_name = t2.flag_name AND
+t2.inst_id = 3)
+WHERE t1.inst_id = 0 AND t1.ts_id=111056548820001 AND
+t2.flag_value IS NULL;
+flag_name flag_value
+flag2 NULL
+DROP TABLE t1,t2;
+CREATE TABLE invoice (
+id int(11) unsigned NOT NULL auto_increment,
+text_id int(10) unsigned default NULL,
+PRIMARY KEY (id)
+);
+INSERT INTO invoice VALUES("1", "0");
+INSERT INTO invoice VALUES("2", "10");
+CREATE TABLE text_table (
+text_id char(3) NOT NULL default '',
+language_id char(3) NOT NULL default '',
+text_data text,
+PRIMARY KEY (text_id,language_id)
+);
+INSERT INTO text_table VALUES("0", "EN", "0-EN");
+INSERT INTO text_table VALUES("0", "SV", "0-SV");
+INSERT INTO text_table VALUES("10", "EN", "10-EN");
+INSERT INTO text_table VALUES("10", "SV", "10-SV");
+SELECT invoice.id, invoice.text_id, text_table.text_data
+FROM invoice LEFT JOIN text_table
+ON invoice.text_id = text_table.text_id
+AND text_table.language_id = 'SV'
+ WHERE (invoice.id LIKE '%' OR text_table.text_data LIKE '%');
+id text_id text_data
+1 0 0-SV
+2 10 10-SV
+DROP TABLE invoice, text_table;
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index e74bda23da9..cceaf393a60 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -307,3 +307,21 @@ test.t1 check status OK
drop table t1;
create table t1 (c char(10), index (c(0)));
ERROR HY000: Key part 'c' length cannot be 0
+create table t1 (c char(10), index (c,c));
+ERROR 42S21: Duplicate column name 'c'
+create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1));
+ERROR 42S21: Duplicate column name 'c1'
+create table t1 (c1 char(10), c2 char(10));
+alter table t1 add key (c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c2,c1,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c2,c1);
+ERROR 42S21: Duplicate column name 'c1'
+alter table t1 add key (c1,c1,c2);
+ERROR 42S21: Duplicate column name 'c1'
+drop table t1;
diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result
index fe8708f882d..79b5a6e84b2 100644
--- a/mysql-test/r/key_cache.result
+++ b/mysql-test/r/key_cache.result
@@ -277,3 +277,13 @@ Key_blocks_unused KEY_BLOCKS_UNUSED
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
set global keycache3.key_buffer_size=0;
+create table t1 (mytext text, FULLTEXT (mytext));
+insert t1 values ('aaabbb');
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+set GLOBAL key_cache_block_size=2048;
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
diff --git a/mysql-test/r/limit.result b/mysql-test/r/limit.result
index c82105e6a49..6a3d2bffab0 100644
--- a/mysql-test/r/limit.result
+++ b/mysql-test/r/limit.result
@@ -67,3 +67,12 @@ SELECT * FROM t1;
id id2
3 0
DROP TABLE t1;
+create table t1 (a integer);
+insert into t1 values (1);
+select 1 as a from t1 union all select 1 from dual limit 1;
+a
+1
+(select 1 as a from t1) union all (select 1 from dual) limit 1;
+a
+1
+drop table t1;
diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result
index 3be73f6cc6a..8361b66817a 100644
--- a/mysql-test/r/lowercase_table2.result
+++ b/mysql-test/r/lowercase_table2.result
@@ -131,3 +131,31 @@ show tables like 't1%';
Tables_in_test (t1%)
t1
drop table t1;
+create temporary table T1(a int(11), b varchar(8));
+insert into T1 values (1, 'abc');
+select * from T1;
+a b
+1 abc
+alter table T1 add index (a);
+select * from T1;
+a b
+1 abc
+drop table T1;
+create database mysqltest_LC2;
+use mysqltest_LC2;
+create table myUC (i int);
+insert into myUC values (1),(2),(3);
+select * from myUC;
+i
+1
+2
+3
+use test;
+drop database mysqltest_LC2;
+create database mysqltest_LC2;
+use mysqltest_LC2;
+create table myUC (i int);
+select * from myUC;
+i
+use test;
+drop database mysqltest_LC2;
diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result
index a645e46be9e..8182d07c26b 100644
--- a/mysql-test/r/lowercase_table3.result
+++ b/mysql-test/r/lowercase_table3.result
@@ -6,5 +6,5 @@ drop table t1;
flush tables;
CREATE TABLE t1 (a int) ENGINE=INNODB;
SELECT * from T1;
-ERROR HY000: Can't open file: 'T1.InnoDB' (errno: 1)
+ERROR HY000: Can't open file: 'T1.ibd' (errno: 1)
drop table t1;
diff --git a/mysql-test/r/lowercase_table_grant.result b/mysql-test/r/lowercase_table_grant.result
new file mode 100644
index 00000000000..3889bd418db
--- /dev/null
+++ b/mysql-test/r/lowercase_table_grant.result
@@ -0,0 +1,23 @@
+use mysql;
+create database MYSQLtest;
+grant all on MySQLtest.* to mysqltest_1@localhost;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+select * from db where user = 'mysqltest_1';
+Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv
+localhost mysqltest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y
+update db set db = 'MYSQLtest' where db = 'mysqltest' and user = 'mysqltest_1' and host = 'localhost';
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+select * from db where user = 'mysqltest_1';
+Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv
+localhost MYSQLtest mysqltest_1 Y Y Y Y Y Y N Y Y Y Y Y
+delete from db where db = 'MYSQLtest' and user = 'mysqltest_1' and host = 'localhost';
+flush privileges;
+drop user mysqltest_1@localhost;
+drop database MYSQLtest;
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index 5755033190b..79d8f019ce3 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -651,3 +651,33 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select * from t2;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
+create table t1 (a int,b int,c int, index (a,b,c));
+create table t2 (a int,b int,c int, index (a,b,c));
+create table t3 (a int,b int,c int, index (a,b,c))
+engine=merge union=(t1 ,t2);
+insert into t1 (a,b,c) values (1,1,0),(1,2,0);
+insert into t2 (a,b,c) values (1,1,1),(1,2,1);
+explain select a,b,c from t3 force index (a) where a=1 order by a,b,c;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
+select a,b,c from t3 force index (a) where a=1 order by a,b,c;
+a b c
+1 1 0
+1 1 1
+1 2 0
+1 2 1
+explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
+select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
+a b c
+1 2 1
+1 2 0
+1 1 1
+1 1 0
+show index from t3;
+Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
+t3 1 a 1 a A NULL NULL NULL YES BTREE
+t3 1 a 2 b A NULL NULL NULL YES BTREE
+t3 1 a 3 c A NULL NULL NULL YES BTREE
+drop table t1, t2, t3;
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index ced3ca61f80..54b3f1e0466 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -1,11 +1,11 @@
drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def 1 8 1 1 N 32769 0 8
-def 1.0 5 3 3 N 32769 1 8
-def -1 8 1 2 N 32769 0 8
+def 1 8 1 1 N 32897 0 63
+def 1.0 5 3 3 N 32897 1 63
+def -1 8 2 2 N 32897 0 63
def hello 254 5 5 N 1 31 8
-def NULL 6 0 0 Y 32768 0 8
+def NULL 6 0 0 Y 32896 0 63
1 1.0 -1 hello NULL
1 1.0 -1 hello NULL
create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10));
diff --git a/mysql-test/r/mix_innodb_myisam_binlog.result b/mysql-test/r/mix_innodb_myisam_binlog.result
index 54d99d5609e..72288d1027b 100644
--- a/mysql-test/r/mix_innodb_myisam_binlog.result
+++ b/mysql-test/r/mix_innodb_myisam_binlog.result
@@ -180,4 +180,25 @@ master-bin.000001 79 Query 1 79 use `test`; BEGIN
master-bin.000001 119 Query 1 79 use `test`; insert into t1 values(16)
master-bin.000001 179 Query 1 79 use `test`; insert into t1 values(18)
master-bin.000001 239 Query 1 239 use `test`; COMMIT
+delete from t1;
+delete from t2;
+alter table t2 type=MyISAM;
+insert into t1 values (1);
+begin;
+select * from t1 for update;
+a
+1
+select (@before:=unix_timestamp())*0;
+(@before:=unix_timestamp())*0
+0
+begin;
+ select * from t1 for update;
+insert into t2 values (20);
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+select (@after:=unix_timestamp())*0;
+(@after:=unix_timestamp())*0
+0
+select (@after-@before) >= 2;
+(@after-@before) >= 2
+1
drop table t1,t2;
diff --git a/mysql-test/r/multi_statement.result b/mysql-test/r/multi_statement.result
index 4451b0a355e..3a8d86bf349 100644
--- a/mysql-test/r/multi_statement.result
+++ b/mysql-test/r/multi_statement.result
@@ -31,3 +31,20 @@ select 5'abcd'
select 'finish';
finish
finish
+flush status;
+create table t1 (i int);
+insert into t1 values (1);
+select * from t1 where i = 1;
+insert into t1 values (2),(3),(4);
+select * from t1 where i = 2;
+select * from t1 where i = 3||||
+i
+1
+i
+2
+i
+3
+show status like 'Slow_queries'||||
+Variable_name Value
+Slow_queries 2
+drop table t1||||
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result
index 045a1b05e47..dba10296063 100644
--- a/mysql-test/r/multi_update.result
+++ b/mysql-test/r/multi_update.result
@@ -464,3 +464,14 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause
delete t1 from t1,t2 where t1.col1 < (select max(col1) from t1) and t1.col1 = t2.col1;
ERROR HY000: You can't specify target table 't1' for update in FROM clause
drop table t1,t2;
+create table t1 (
+aclid bigint not null primary key,
+status tinyint(1) not null
+) engine = innodb;
+create table t2 (
+refid bigint not null primary key,
+aclid bigint, index idx_acl(aclid)
+) engine = innodb;
+insert into t2 values(1,null);
+delete t2, t1 from t2 left join t1 on (t2.aclid=t1.aclid) where t2.refid='1';
+drop table t1, t2;
diff --git a/mysql-test/r/myisam-blob.result.es b/mysql-test/r/myisam-blob.result.es
new file mode 100644
index 00000000000..4031b9cfd1c
--- /dev/null
+++ b/mysql-test/r/myisam-blob.result.es
@@ -0,0 +1,59 @@
+drop table if exists t1;
+CREATE TABLE t1 (data LONGBLOB) ENGINE=myisam;
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+select length(data) from t1;
+length(data)
+NULL
+delete from t1 where left(data,1)='a';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+truncate table t1;
+INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+delete from t1 where left(data,1)='b';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+UPDATE t1 set data=repeat('c',17*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+delete from t1 where left(data,1)='c';
+check table t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+INSERT INTO t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+select length(data) from t1;
+length(data)
+NULL
+NULL
+NULL
+alter table t1 modify data blob;
+select length(data) from t1;
+length(data)
+NULL
+NULL
+NULL
+drop table t1;
+CREATE TABLE t1 (data BLOB) ENGINE=myisam;
+INSERT INTO t1 (data) VALUES (NULL);
+UPDATE t1 set data=repeat('a',18*1024*1024);
+Warnings:
+Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
+select length(data) from t1;
+length(data)
+NULL
+drop table t1;
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index 26dcce43d08..d155a14bb60 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -529,6 +529,7 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A NULL NULL NULL YES BTREE disabled
create table t2 (a int);
+set @@rand_seed1=31415926,@@rand_seed2=2718281828;
insert t1 select * from t2;
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
@@ -543,7 +544,7 @@ Warnings:
Note 1031 Table storage engine for 't1' doesn't have this option
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
-t1 1 a 1 a NULL NULL NULL NULL YES HASH
+t1 1 a 1 a NULL 1000 NULL NULL YES HASH
drop table t1,t2;
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
insert into t1 values (null,''), (null,'');
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 7e69620394b..f763a16836f 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -60,7 +60,8 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456)
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
@@ -80,10 +81,12 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE TABLE `t1` (
`a` decimal(10,5) default NULL,
`b` float default NULL
@@ -94,6 +97,7 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456)
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
CREATE TABLE t1(a int, b text, c varchar(3));
@@ -149,7 +153,8 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` varchar(255) default NULL
@@ -169,13 +174,15 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL40" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -191,10 +198,12 @@ UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,MYSQL323" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -210,6 +219,7 @@ UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;
create table ```a` (i int);
@@ -225,7 +235,8 @@ create table t1(a int);
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -243,10 +254,12 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,ANSI" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a" int(11) default NULL
@@ -261,6 +274,7 @@ UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
set global sql_mode='ANSI_QUOTES';
@@ -270,7 +284,8 @@ set global sql_mode='ANSI_QUOTES';
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -288,10 +303,12 @@ UNLOCK TABLES;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO,ANSI" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS "t1";
CREATE TABLE "t1" (
"a" int(11) default NULL
@@ -306,6 +323,7 @@ UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
set global sql_mode='';
drop table t1;
@@ -316,7 +334,8 @@ insert into t1 values (1),(2),(3);
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="" */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@@ -327,8 +346,206 @@ CREATE TABLE `t1` (
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
1
2
3
drop table t1;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+create database mysqldump_test_db character set latin2 collate latin2_bin;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_bin */;
+
+USE `mysqldump_test_db`;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+drop database mysqldump_test_db;
+CREATE TABLE t1 (a CHAR(10));
+INSERT INTO t1 VALUES (_latin1 'ÄÖÜß');
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('ÄÖÜß');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('ÄÖÜß');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('Ž™šá');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('Ž™šá');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` char(10) default NULL
+) TYPE=MyISAM;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES ('ÄÖÜß');
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (a int);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (4),(5),(6);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+LOCK TABLES `t2` WRITE;
+INSERT INTO `t2` VALUES (4),(5),(6);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result
index 4e30d5bc110..d75dbd5d00c 100644
--- a/mysql-test/r/mysqltest.result
+++ b/mysql-test/r/mysqltest.result
@@ -1,14 +1,12 @@
+select -1 as "before_use_test" ;
+before_use_test
+-1
select otto from (select 1 as otto) as t1;
otto
1
select otto from (select 1 as otto) as t1;
otto
1
-select otto from (select 1 as otto) as t1;
-otto
-1
-select friedrich from (select 1 as otto) as t1;
-ERROR 42S22: Unknown column 'friedrich' in 'field list'
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
select otto from (select 1 as otto) as t1;
@@ -21,3 +19,126 @@ select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
select friedrich from (select 1 as otto) as t1;
ERROR 42S22: Unknown column 'friedrich' in 'field list'
+select otto from (select 1 as otto) as t1;
+otto
+1
+select 0 as "after_successful_stmt_errno" ;
+after_successful_stmt_errno
+0
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 1064 as "after_wrong_syntax_errno" ;
+after_wrong_syntax_errno
+1064
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 1064 as "after_let_var_equal_value" ;
+after_let_var_equal_value
+1064
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+set @my_var= 'abc' ;
+select 0 as "after_set_var_equal_value" ;
+after_set_var_equal_value
+0
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 1064 as "after_disable_warnings_command" ;
+after_disable_warnings_command
+1064
+drop table if exists t1 ;
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+drop table if exists t1 ;
+select 0 as "after_disable_warnings" ;
+after_disable_warnings
+0
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_minus_masked" ;
+after_minus_masked
+1146
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_!_masked" ;
+after_!_masked
+1146
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select -1 as "after_let_errno_equal_value" ;
+after_let_errno_equal_value
+-1
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+prepare stmt from "select 3 from t1" ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_failing_prepare" ;
+after_failing_prepare
+1146
+create table t1 ( f1 char(10));
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+prepare stmt from "select 3 from t1" ;
+select 0 as "after_successful_prepare" ;
+after_successful_prepare
+0
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+execute stmt;
+3
+select 0 as "after_successful_execute" ;
+after_successful_execute
+0
+drop table t1;
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+execute stmt;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_failing_execute" ;
+after_failing_execute
+1146
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+execute __stmt_;
+ERROR HY000: Unknown prepared statement handler (__stmt_) given to EXECUTE
+select 1243 as "after_failing_execute" ;
+after_failing_execute
+1243
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+deallocate prepare stmt;
+select 0 as "after_successful_deallocate" ;
+after_successful_deallocate
+0
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+deallocate prepare __stmt_;
+ERROR HY000: Unknown prepared statement handler (__stmt_) given to DEALLOCATE PREPARE
+select 1243 as "after_failing_deallocate" ;
+after_failing_deallocate
+1243
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 1064 as "after_--disable_abort_on_error" ;
+after_--disable_abort_on_error
+1064
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
+select 1146 as "after_!errno_masked_error" ;
+after_!errno_masked_error
+1146
+garbage ;
+ERROR 42000: 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 'garbage' at line 1
+select 1064 as "after_--enable_abort_on_error" ;
+after_--enable_abort_on_error
+1064
+select 3 from t1 ;
+ERROR 42S02: Table 'test.t1' doesn't exist
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index ee7c3b28fe2..f899d254243 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -1,4 +1,5 @@
DROP TABLE IF EXISTS t1;
+drop database if exists mysqltest;
CREATE TABLE t1 (
a INT NOT NULL,
b INT NOT NULL
@@ -9,6 +10,21 @@ SELECT * FROM t1;
a b c
9410 9412 0
DROP TABLE t1;
+CREATE DATABASE mysqltest;
+USE mysqltest;
+CREATE TABLE t1 (
+a INT NOT NULL,
+b INT NOT NULL
+) ENGINE=ndbcluster;
+RENAME TABLE t1 TO test.t1;
+SHOW TABLES;
+Tables_in_mysqltest
+DROP DATABASE mysqltest;
+USE test;
+SHOW TABLES;
+Tables_in_test
+t1
+DROP TABLE t1;
create table t1 (
col1 int not null auto_increment primary key,
col2 varchar(30) not null,
diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result
index 23f089b9bc0..b7afb5918a4 100644
--- a/mysql-test/r/ndb_autodiscover.result
+++ b/mysql-test/r/ndb_autodiscover.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
flush status;
create table t1(
id int not null primary key,
@@ -363,3 +363,8 @@ a int NOT NULL PRIMARY KEY,
b int
) engine=ndb;
insert t9 values(1, 2), (2,3), (3, 4), (4, 5);
+create table t10 (
+a int not null primary key,
+b blob
+) engine=ndb;
+insert into t10 values (1, 'kalle');
diff --git a/mysql-test/r/ndb_autodiscover2.result b/mysql-test/r/ndb_autodiscover2.result
index 08803d997a5..91f018b5d02 100644
--- a/mysql-test/r/ndb_autodiscover2.result
+++ b/mysql-test/r/ndb_autodiscover2.result
@@ -8,3 +8,6 @@ show status like 'handler_discover%';
Variable_name Value
Handler_discover 1
drop table t9;
+select * from t10;
+ERROR HY000: Got error 4263 'Invalid blob attributes or invalid blob parts table' from ndbcluster
+drop table t10;
diff --git a/mysql-test/r/ndb_basic.result b/mysql-test/r/ndb_basic.result
index abe1b98b536..a6396080ef0 100644
--- a/mysql-test/r/ndb_basic.result
+++ b/mysql-test/r/ndb_basic.result
@@ -40,6 +40,11 @@ SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 attr2 attr3
3 1 NULL 9412
9412 9413 17 9413
+UPDATE t1 SET pk1=4 WHERE pk1 = 3;
+SELECT * FROM t1 ORDER BY pk1;
+pk1 attr1 attr2 attr3
+4 1 NULL 9412
+9412 9413 17 9413
DELETE FROM t1;
SELECT * FROM t1;
pk1 attr1 attr2 attr3
@@ -395,6 +400,13 @@ b attr1
9413 9412
drop table test.t1, t2;
drop database mysqltest;
+drop database if exists ndbtest1;
+create database ndbtest1;
+use ndbtest1;
+create table t1(id int) engine=ndbcluster;
+drop database ndbtest1;
+drop database ndbtest1;
+ERROR HY000: Can't drop database 'ndbtest1'; database doesn't exist
use test;
create table t1 (a int primary key, b char(0));
insert into t1 values (1,"");
@@ -414,3 +426,184 @@ select * from t1 where b IS NOT NULL;
a b
1
drop table t1;
+create table t1 (
+c1 int,
+c2 int,
+c3 int,
+c4 int,
+c5 int,
+c6 int,
+c7 int,
+c8 int,
+c9 int,
+c10 int,
+c11 int,
+c12 int,
+c13 int,
+c14 int,
+c15 int,
+c16 int,
+c17 int,
+c18 int,
+c19 int,
+c20 int,
+c21 int,
+c22 int,
+c23 int,
+c24 int,
+c25 int,
+c26 int,
+c27 int,
+c28 int,
+c29 int,
+c30 int,
+c31 int,
+c32 int,
+c33 int,
+c34 int,
+c35 int,
+c36 int,
+c37 int,
+c38 int,
+c39 int,
+c40 int,
+c41 int,
+c42 int,
+c43 int,
+c44 int,
+c45 int,
+c46 int,
+c47 int,
+c48 int,
+c49 int,
+c50 int,
+c51 int,
+c52 int,
+c53 int,
+c54 int,
+c55 int,
+c56 int,
+c57 int,
+c58 int,
+c59 int,
+c60 int,
+c61 int,
+c62 int,
+c63 int,
+c64 int,
+c65 int,
+c66 int,
+c67 int,
+c68 int,
+c69 int,
+c70 int,
+c71 int,
+c72 int,
+c73 int,
+c74 int,
+c75 int,
+c76 int,
+c77 int,
+c78 int,
+c79 int,
+c80 int,
+c81 int,
+c82 int,
+c83 int,
+c84 int,
+c85 int,
+c86 int,
+c87 int,
+c88 int,
+c89 int,
+c90 int,
+c91 int,
+c92 int,
+c93 int,
+c94 int,
+c95 int,
+c96 int,
+c97 int,
+c98 int,
+c99 int,
+c100 int,
+c101 int,
+c102 int,
+c103 int,
+c104 int,
+c105 int,
+c106 int,
+c107 int,
+c108 int,
+c109 int,
+c110 int,
+c111 int,
+c112 int,
+c113 int,
+c114 int,
+c115 int,
+c116 int,
+c117 int,
+c118 int,
+c119 int,
+c120 int,
+c121 int,
+c122 int,
+c123 int,
+c124 int,
+c125 int,
+c126 int,
+c127 int,
+c128 int,
+primary key(c1)) engine=ndb;
+drop table t1;
+create table t1 (
+a1234567890123456789012345678901234567890 int primary key,
+a12345678901234567890123456789a1234567890 int,
+index(a12345678901234567890123456789a1234567890)
+) engine=ndb;
+show tables;
+Tables_in_test
+t1
+insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
+explain select * from t1 where a12345678901234567890123456789a1234567890=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const 10 Using where
+select * from t1 where a12345678901234567890123456789a1234567890=2;
+a1234567890123456789012345678901234567890 a12345678901234567890123456789a1234567890
+5 2
+drop table t1;
+create table t1
+(a bigint, b bigint, c bigint, d bigint,
+primary key (a,b,c,d))
+engine=ndb
+max_rows=200000000;
+Warnings:
+Warning 1105 Ndb might have problems storing the max amount of rows specified
+insert into t1 values
+(1,2,3,4),(2,3,4,5),(3,4,5,6),
+(3,2,3,4),(1,3,4,5),(2,4,5,6),
+(1,2,3,5),(2,3,4,8),(3,4,5,9),
+(3,2,3,5),(1,3,4,8),(2,4,5,9),
+(1,2,3,6),(2,3,4,6),(3,4,5,7),
+(3,2,3,6),(1,3,4,6),(2,4,5,7),
+(1,2,3,7),(2,3,4,7),(3,4,5,8),
+(3,2,3,7),(1,3,4,7),(2,4,5,8),
+(1,3,3,4),(2,4,4,5),(3,5,5,6),
+(3,3,3,4),(1,4,4,5),(2,5,5,6),
+(1,3,3,5),(2,4,4,8),(3,5,5,9),
+(3,3,3,5),(1,4,4,8),(2,5,5,9),
+(1,3,3,6),(2,4,4,6),(3,5,5,7),
+(3,3,3,6),(1,4,4,6),(2,5,5,7),
+(1,3,3,7),(2,4,4,7),(3,5,5,8),
+(3,3,3,7),(1,4,4,7),(2,5,5,8);
+select count(*) from t1;
+count(*)
+48
+drop table t1;
+create table t1
+(a bigint, b bigint, c bigint, d bigint,
+primary key (a))
+engine=ndb
+max_rows=1;
+drop table t1;
diff --git a/mysql-test/r/ndb_blob.result b/mysql-test/r/ndb_blob.result
index cf64ec41ae3..6f25ec95c80 100644
--- a/mysql-test/r/ndb_blob.result
+++ b/mysql-test/r/ndb_blob.result
@@ -1,25 +1,5 @@
drop table if exists t1;
-drop database if exists mysqltest;
-create table t1 (
-a int not null primary key,
-b tinytext
-) engine=ndbcluster;
-insert into t1 values(1, 'x');
-update t1 set b = 'y';
-select * from t1;
-a b
-1 y
-delete from t1;
-drop table t1;
-create table t1 (
-a int not null primary key,
-b text not null
-) engine=ndbcluster;
-insert into t1 values(1, '');
-select * from t1;
-a b
-1
-drop table t1;
+drop database if exists test2;
set autocommit=0;
create table t1 (
a int not null primary key,
@@ -102,6 +82,53 @@ commit;
select count(*) from t1;
count(*)
0
+replace t1 set a=1,b=@b1,c=111,d=@d1;
+replace t1 set a=2,b=@b2,c=222,d=@d2;
+commit;
+explain select * from t1 where a = 1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+1 2256 b1 3000 dd1
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+2 20000 b2 30000 dd2
+replace t1 set a=1,b=@b2,c=111,d=@d2;
+replace t1 set a=2,b=@b1,c=222,d=@d1;
+commit;
+select a,length(b),substr(b,1+2*9000,2),length(d),substr(d,1+3*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+2*9000,2) length(d) substr(d,1+3*9000,3)
+1 20000 b2 30000 dd2
+select a,length(b),substr(b,1+2*900,2),length(d),substr(d,1+3*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+2*900,2) length(d) substr(d,1+3*900,3)
+2 2256 b1 3000 dd1
+replace t1 set a=1,b=concat(@b2,@b2),c=111,d=concat(@d2,@d2);
+replace t1 set a=2,b=concat(@b1,@b1),c=222,d=concat(@d1,@d1);
+commit;
+select a,length(b),substr(b,1+4*9000,2),length(d),substr(d,1+6*9000,3)
+from t1 where a=1;
+a length(b) substr(b,1+4*9000,2) length(d) substr(d,1+6*9000,3)
+1 40000 b2 60000 dd2
+select a,length(b),substr(b,1+4*900,2),length(d),substr(d,1+6*900,3)
+from t1 where a=2;
+a length(b) substr(b,1+4*900,2) length(d) substr(d,1+6*900,3)
+2 4512 b1 6000 dd1
+replace t1 set a=1,b='xyz',c=111,d=null;
+commit;
+select a,b from t1 where d is null;
+a b
+1 xyz
+delete from t1 where a=1;
+delete from t1 where a=2;
+commit;
+select count(*) from t1;
+count(*)
+0
insert into t1 values(1,@b1,111,@d1);
insert into t1 values(2,@b2,222,@d2);
commit;
@@ -241,90 +268,6 @@ a b c d
7 7xb7 777 7xdd7
8 8xb8 888 8xdd8
9 9xb9 999 9xdd9
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
-alter table t1 add x int;
-select * from t1 order by a;
-a b c d x
-1 1xb1 111 1xdd1 NULL
-2 2xb2 222 2xdd2 NULL
-3 3xb3 333 3xdd3 NULL
-4 4xb4 444 4xdd4 NULL
-5 5xb5 555 5xdd5 NULL
-6 6xb6 666 6xdd6 NULL
-7 7xb7 777 7xdd7 NULL
-8 8xb8 888 8xdd8 NULL
-9 9xb9 999 9xdd9 NULL
-alter table t1 drop x;
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
-create database mysqltest;
-use mysqltest;
-CREATE TABLE t2 (
-a bigint unsigned NOT NULL PRIMARY KEY,
-b int unsigned not null,
-c int unsigned
-) engine=ndbcluster;
-insert into t2 values (1,1,1),(2,2,2);
-select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
-a b c d a b c
-1 1xb1 111 1xdd1 1 1 1
-2 2xb2 222 2xdd2 2 2 2
-drop table t2;
-use test;
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
-alter table t1 add x int;
-select * from t1 order by a;
-a b c d x
-1 1xb1 111 1xdd1 NULL
-2 2xb2 222 2xdd2 NULL
-3 3xb3 333 3xdd3 NULL
-4 4xb4 444 4xdd4 NULL
-5 5xb5 555 5xdd5 NULL
-6 6xb6 666 6xdd6 NULL
-7 7xb7 777 7xdd7 NULL
-8 8xb8 888 8xdd8 NULL
-9 9xb9 999 9xdd9 NULL
-alter table t1 drop x;
-select * from t1 order by a;
-a b c d
-1 1xb1 111 1xdd1
-2 2xb2 222 2xdd2
-3 3xb3 333 3xdd3
-4 4xb4 444 4xdd4
-5 5xb5 555 5xdd5
-6 6xb6 666 6xdd6
-7 7xb7 777 7xdd7
-8 8xb8 888 8xdd8
-9 9xb9 999 9xdd9
delete from t1 where c >= 100;
commit;
select count(*) from t1;
@@ -375,8 +318,128 @@ rollback;
select count(*) from t1;
count(*)
0
+insert into t1 values(1,'b1',111,'dd1');
+insert into t1 values(2,'b2',222,'dd2');
+insert into t1 values(3,'b3',333,'dd3');
+insert into t1 values(4,'b4',444,'dd4');
+insert into t1 values(5,'b5',555,'dd5');
+insert into t1 values(6,'b6',666,'dd6');
+insert into t1 values(7,'b7',777,'dd7');
+insert into t1 values(8,'b8',888,'dd8');
+insert into t1 values(9,'b9',999,'dd9');
+commit;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 b1 111 dd1 NULL
+2 b2 222 dd2 NULL
+3 b3 333 dd3 NULL
+4 b4 444 dd4 NULL
+5 b5 555 dd5 NULL
+6 b6 666 dd6 NULL
+7 b7 777 dd7 NULL
+8 b8 888 dd8 NULL
+9 b9 999 dd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+create database test2;
+use test2;
+CREATE TABLE t2 (
+a bigint unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned
+) engine=ndbcluster;
+insert into t2 values (1,1,1),(2,2,2);
+select * from test.t1,t2 where test.t1.a = t2.a order by test.t1.a;
+a b c d a b c
+1 b1 111 dd1 1 1 1
+2 b2 222 dd2 2 2 2
+drop table t2;
+use test;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+alter table t1 add x int;
+select * from t1 order by a;
+a b c d x
+1 b1 111 dd1 NULL
+2 b2 222 dd2 NULL
+3 b3 333 dd3 NULL
+4 b4 444 dd4 NULL
+5 b5 555 dd5 NULL
+6 b6 666 dd6 NULL
+7 b7 777 dd7 NULL
+8 b8 888 dd8 NULL
+9 b9 999 dd9 NULL
+alter table t1 drop x;
+select * from t1 order by a;
+a b c d
+1 b1 111 dd1
+2 b2 222 dd2
+3 b3 333 dd3
+4 b4 444 dd4
+5 b5 555 dd5
+6 b6 666 dd6
+7 b7 777 dd7
+8 b8 888 dd8
+9 b9 999 dd9
+drop table t1;
+drop database test2;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b tinytext
+) engine=ndbcluster;
+insert into t1 values(1, 'x');
+update t1 set b = 'y';
+select * from t1;
+a b
+1 y
+delete from t1;
+select * from t1;
+a b
+commit;
+drop table t1;
+set autocommit=0;
+create table t1 (
+a int not null primary key,
+b text not null
+) engine=ndbcluster;
+insert into t1 values(1, '');
+select * from t1;
+a b
+1
+commit;
drop table t1;
-drop database mysqltest;
set autocommit=1;
use test;
CREATE TABLE t1 (
@@ -397,9 +460,28 @@ select * from t1 order by a;
a b
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
+set autocommit=1;
alter table t1 engine=myisam;
select * from t1 order by a;
a b
1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
2 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
drop table t1;
+create table t1 (
+id int(11) unsigned primary key NOT NULL auto_increment,
+msg text NOT NULL
+) engine=ndbcluster default charset=utf8;
+insert into t1 (msg) values(
+'Tries to validate (8 byte length + inline bytes) as UTF8 :(
+Fast fix: removed validation for Text. It is not yet indexable
+so bad data will not crash kernel.
+Proper fix: Set inline bytes to multiple of mbmaxlen and
+validate it (after the 8 byte length).');
+select * from t1;
+id msg
+1 Tries to validate (8 byte length + inline bytes) as UTF8 :(
+Fast fix: removed validation for Text. It is not yet indexable
+so bad data will not crash kernel.
+Proper fix: Set inline bytes to multiple of mbmaxlen and
+validate it (after the 8 byte length).
+drop table t1;
diff --git a/mysql-test/r/ndb_charset.result b/mysql-test/r/ndb_charset.result
index 93429a1fcb0..00bc36a7c0d 100644
--- a/mysql-test/r/ndb_charset.result
+++ b/mysql-test/r/ndb_charset.result
@@ -78,9 +78,9 @@ unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '2' for key 1
insert into t1 values(3, 'AAA');
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '3' for key 1
select * from t1 order by p;
p a
1 aAa
@@ -189,3 +189,13 @@ p a
5 aaa
6 AAA
drop table t1;
+create table t1 (
+a varchar(10) primary key
+) engine=ndb;
+insert into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+replace into t1 values ('jonas % ');
+select * from t1;
+a
+jonas %
+drop table t1;
diff --git a/mysql-test/r/ndb_grant.result b/mysql-test/r/ndb_grant.result
new file mode 100644
index 00000000000..6583065a0c4
--- /dev/null
+++ b/mysql-test/r/ndb_grant.result
@@ -0,0 +1,416 @@
+drop table if exists t1;
+SET NAMES binary;
+use mysql;
+alter table columns_priv engine=ndb;
+alter table db engine=ndb;
+alter table func engine=ndb;
+alter table help_category engine=ndb;
+alter table help_keyword engine=ndb;
+alter table help_relation engine=ndb;
+alter table help_topic engine=ndb;
+alter table host engine=ndb;
+alter table tables_priv engine=ndb;
+alter table time_zone engine=ndb;
+alter table time_zone_leap_second engine=ndb;
+alter table time_zone_name engine=ndb;
+alter table time_zone_transition engine=ndb;
+alter table time_zone_transition_type engine=ndb;
+alter table user engine=ndb;
+use test;
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+flush privileges;
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant delete on mysqltest.* to mysqltest_1@localhost;
+commit;
+select * from mysql.user where user="mysqltest_1";
+Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections
+localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT, DELETE ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke delete on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant select on mysqltest.* to mysqltest_1@localhost require NONE;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant USAGE on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "testsubject" ISSUER "MySQL AB";
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE ISSUER 'MySQL AB' SUBJECT 'testsubject' CIPHER 'EDH-RSA-DES-CBC3-SHA'
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant CREATE TEMPORARY TABLES, LOCK TABLES on mysqltest.* to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT CREATE TEMPORARY TABLES, LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+revoke CREATE TEMPORARY TABLES on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT LOCK TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
+begin;
+grant ALL PRIVILEGES on mysqltest.* to mysqltest_1@localhost with GRANT OPTION;
+commit;
+flush privileges;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+begin;
+revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+begin;
+revoke all privileges on mysqltest.* from mysqltest_1@localhost;
+commit;
+delete from mysql.user where user='mysqltest_1';
+flush privileges;
+begin;
+grant usage on test.* to mysqltest_1@localhost with grant option;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT USAGE ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+GRANT USAGE ON `test`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
+delete from mysql.user where user='mysqltest_1';
+delete from mysql.db where user='mysqltest_1';
+delete from mysql.tables_priv where user='mysqltest_1';
+delete from mysql.columns_priv where user='mysqltest_1';
+flush privileges;
+show grants for mysqltest_1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host 'localhost'
+create table t1 (a int);
+begin;
+GRANT select,update,insert on t1 to mysqltest_1@localhost;
+GRANT select (a), update (a),insert(a), references(a) on t1 to mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, SELECT (a), INSERT, INSERT (a), UPDATE, UPDATE (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+table_priv column_priv
+Select,Insert,Update Select,Insert,Update,References
+begin;
+REVOKE select (a), update on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT SELECT, INSERT, INSERT (a), REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+begin;
+REVOKE select,update,insert,insert (a) on t1 from mysqltest_1@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT REFERENCES (a) ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+begin;
+GRANT select,references on t1 to mysqltest_1@localhost;
+commit;
+select table_priv,column_priv from mysql.tables_priv where user="mysqltest_1";
+table_priv column_priv
+Select,References References
+begin;
+grant all on test.* to mysqltest_3@localhost with grant option;
+revoke all on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+GRANT USAGE ON `test`.* TO 'mysqltest_3'@'localhost' WITH GRANT OPTION
+begin;
+revoke grant option on test.* from mysqltest_3@localhost;
+commit;
+show grants for mysqltest_3@localhost;
+Grants for mysqltest_3@localhost
+GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost'
+begin;
+grant all on test.t1 to mysqltest_2@localhost with grant option;
+revoke all on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+GRANT USAGE ON `test`.`t1` TO 'mysqltest_2'@'localhost' WITH GRANT OPTION
+begin;
+revoke grant option on test.t1 from mysqltest_2@localhost;
+commit;
+show grants for mysqltest_2@localhost;
+Grants for mysqltest_2@localhost
+GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost'
+delete from mysql.user where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.db where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.tables_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+delete from mysql.columns_priv where user='mysqltest_1' or user="mysqltest_2" or user="mysqltest_3";
+flush privileges;
+drop table t1;
+begin;
+GRANT FILE on mysqltest.* to mysqltest_1@localhost;
+ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
+commit;
+select 1;
+1
+1
+create database mysqltest1;
+begin;
+grant usage on mysqltest1.* to test6123 identified by 'magic123';
+commit;
+select host,db,user,select_priv,insert_priv from mysql.db where db="mysqltest1";
+host db user select_priv insert_priv
+delete from mysql.user where user='test6123';
+drop database mysqltest1;
+create table t1 (a int);
+begin;
+grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION;
+commit;
+show grants for drop_user2@localhost;
+Grants for drop_user2@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION
+begin;
+revoke all privileges, grant option from drop_user2@localhost;
+commit;
+drop user drop_user2@localhost;
+begin;
+grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION;
+grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION;
+grant select(a) on test.t1 to drop_user@localhost;
+commit;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+set sql_mode=ansi_quotes;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode=default;
+set sql_quote_show_create=0;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_mode="ansi_quotes";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON test.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON test.t1 TO 'drop_user'@'localhost'
+set sql_quote_show_create=1;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON "test".* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON "test"."t1" TO 'drop_user'@'localhost'
+set sql_mode="";
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION
+GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost'
+revoke all privileges, grant option from drop_user@localhost;
+show grants for drop_user@localhost;
+Grants for drop_user@localhost
+GRANT USAGE ON *.* TO 'drop_user'@'localhost'
+drop user drop_user@localhost;
+begin;
+revoke all privileges, grant option from drop_user@localhost;
+ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users
+commit;
+begin;
+grant select(a) on test.t1 to drop_user1@localhost;
+commit;
+flush privileges;
+begin;
+grant select on test.t1 to drop_user2@localhost;
+grant select on test.* to drop_user3@localhost;
+grant select on *.* to drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+ERROR HY000: Can't drop one or more of the requested users
+begin;
+revoke all privileges, grant option from drop_user1@localhost, drop_user2@localhost,
+drop_user3@localhost, drop_user4@localhost;
+commit;
+drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost,
+drop_user4@localhost;
+drop table t1;
+begin;
+grant usage on *.* to mysqltest_1@localhost identified by "password";
+grant select, update, insert on test.* to mysqltest@localhost;
+commit;
+show grants for mysqltest_1@localhost;
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19'
+drop user mysqltest_1@localhost;
+SET NAMES koi8r;
+CREATE DATABASE ÂÄ;
+USE ÂÄ;
+CREATE TABLE ÔÁÂ (ËÏÌ int);
+begin;
+GRANT SELECT ON ÂÄ.* TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.* TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT ON ÂÄ.* FROM ÀÚÅÒ@localhost;
+commit;
+begin;
+GRANT SELECT ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+begin;
+GRANT SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ TO ÀÚÅÒ@localhost;
+commit;
+SHOW GRANTS FOR ÀÚÅÒ@localhost;
+Grants for ÀÚÅÒ@localhost
+GRANT USAGE ON *.* TO 'ÀÚÅÒ'@'localhost'
+GRANT SELECT (ËÏÌ) ON `ÂÄ`.`ÔÁÂ` TO 'ÀÚÅÒ'@'localhost'
+begin;
+REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
+commit;
+DROP DATABASE ÂÄ;
+SET NAMES latin1;
+USE test;
+CREATE TABLE t1 (a int );
+CREATE TABLE t2 LIKE t1;
+CREATE TABLE t3 LIKE t1;
+CREATE TABLE t4 LIKE t1;
+CREATE TABLE t5 LIKE t1;
+CREATE TABLE t6 LIKE t1;
+CREATE TABLE t7 LIKE t1;
+CREATE TABLE t8 LIKE t1;
+CREATE TABLE t9 LIKE t1;
+CREATE TABLE t10 LIKE t1;
+CREATE DATABASE testdb1;
+CREATE DATABASE testdb2;
+CREATE DATABASE testdb3;
+CREATE DATABASE testdb4;
+CREATE DATABASE testdb5;
+CREATE DATABASE testdb6;
+CREATE DATABASE testdb7;
+CREATE DATABASE testdb8;
+CREATE DATABASE testdb9;
+CREATE DATABASE testdb10;
+begin;
+GRANT ALL ON testdb1.* TO testuser@localhost;
+GRANT ALL ON testdb2.* TO testuser@localhost;
+GRANT ALL ON testdb3.* TO testuser@localhost;
+GRANT ALL ON testdb4.* TO testuser@localhost;
+GRANT ALL ON testdb5.* TO testuser@localhost;
+GRANT ALL ON testdb6.* TO testuser@localhost;
+GRANT ALL ON testdb7.* TO testuser@localhost;
+GRANT ALL ON testdb8.* TO testuser@localhost;
+GRANT ALL ON testdb9.* TO testuser@localhost;
+GRANT ALL ON testdb10.* TO testuser@localhost;
+GRANT SELECT ON test.t1 TO testuser@localhost;
+GRANT SELECT ON test.t2 TO testuser@localhost;
+GRANT SELECT ON test.t3 TO testuser@localhost;
+GRANT SELECT ON test.t4 TO testuser@localhost;
+GRANT SELECT ON test.t5 TO testuser@localhost;
+GRANT SELECT ON test.t6 TO testuser@localhost;
+GRANT SELECT ON test.t7 TO testuser@localhost;
+GRANT SELECT ON test.t8 TO testuser@localhost;
+GRANT SELECT ON test.t9 TO testuser@localhost;
+GRANT SELECT ON test.t10 TO testuser@localhost;
+GRANT SELECT (a) ON test.t1 TO testuser@localhost;
+GRANT SELECT (a) ON test.t2 TO testuser@localhost;
+GRANT SELECT (a) ON test.t3 TO testuser@localhost;
+GRANT SELECT (a) ON test.t4 TO testuser@localhost;
+GRANT SELECT (a) ON test.t5 TO testuser@localhost;
+GRANT SELECT (a) ON test.t6 TO testuser@localhost;
+GRANT SELECT (a) ON test.t7 TO testuser@localhost;
+GRANT SELECT (a) ON test.t8 TO testuser@localhost;
+GRANT SELECT (a) ON test.t9 TO testuser@localhost;
+GRANT SELECT (a) ON test.t10 TO testuser@localhost;
+commit;
+begin;
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM testuser@localhost;
+commit;
+SHOW GRANTS FOR testuser@localhost;
+Grants for testuser@localhost
+GRANT USAGE ON *.* TO 'testuser'@'localhost'
+DROP USER testuser@localhost;
+DROP TABLE t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
+DROP DATABASE testdb1;
+DROP DATABASE testdb2;
+DROP DATABASE testdb3;
+DROP DATABASE testdb4;
+DROP DATABASE testdb5;
+DROP DATABASE testdb6;
+DROP DATABASE testdb7;
+DROP DATABASE testdb8;
+DROP DATABASE testdb9;
+DROP DATABASE testdb10;
+use mysql;
+alter table columns_priv engine=myisam;
+alter table db engine=myisam;
+alter table func engine=myisam;
+alter table help_category engine=myisam;
+alter table help_keyword engine=myisam;
+alter table help_relation engine=myisam;
+alter table help_topic engine=myisam;
+alter table host engine=myisam;
+alter table tables_priv engine=myisam;
+alter table time_zone engine=myisam;
+alter table time_zone_leap_second engine=myisam;
+alter table time_zone_name engine=myisam;
+alter table time_zone_transition engine=myisam;
+alter table time_zone_transition_type engine=myisam;
+alter table user engine=myisam;
+use test;
+flush privileges;
diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result
index 2dc260ec43d..f5794d477f3 100644
--- a/mysql-test/r/ndb_index_ordered.result
+++ b/mysql-test/r/ndb_index_ordered.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, test1, test2;
CREATE TABLE t1 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
@@ -275,3 +275,271 @@ a b c
1 1 1
4 4 NULL
drop table t1;
+CREATE TABLE test1 (
+SubscrID int(11) NOT NULL auto_increment,
+UsrID int(11) NOT NULL default '0',
+PRIMARY KEY (SubscrID),
+KEY idx_usrid (UsrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO test1 VALUES (2,224),(3,224),(1,224);
+CREATE TABLE test2 (
+SbclID int(11) NOT NULL auto_increment,
+SbcrID int(11) NOT NULL default '0',
+PRIMARY KEY (SbclID),
+KEY idx_sbcrid (SbcrID)
+) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
+INSERT INTO test2 VALUES (3,2),(1,1),(2,1),(4,2);
+select * from test1 order by 1;
+SubscrID UsrID
+1 224
+2 224
+3 224
+select * from test2 order by 1;
+SbclID SbcrID
+1 1
+2 1
+3 2
+4 2
+SELECT s.SubscrID,l.SbclID FROM test1 s left JOIN test2 l ON
+l.SbcrID=s.SubscrID WHERE s.UsrID=224 order by 1, 2;
+SubscrID SbclID
+1 1
+1 2
+2 3
+2 4
+3 NULL
+drop table test1;
+drop table test2;
+create table t1 (
+pk int primary key,
+dt datetime not null,
+da date not null,
+ye year not null,
+ti time not null,
+ts timestamp not null,
+index(dt),
+index(da),
+index(ye),
+index(ti),
+index(ts)
+) engine=ndb;
+insert into t1 (pk,dt,da,ye,ti,ts) values
+(1, '1901-05-05 23:00:59', '1901-05-05', '1901', '23:00:59', '2001-01-01 23:00:59'),
+(2, '1912-09-05 13:00:59', '1912-09-05', '1912', '13:00:59', '2001-01-01 13:00:59'),
+(3, '1945-12-31 00:00:00', '1945-12-31', '1945', '00:00:00', '2001-01-01 00:00:00'),
+(4, '1955-12-31 00:00:00', '1955-12-31', '1955', '00:00:00', '2001-01-01 00:00:00'),
+(5, '1963-06-06 06:06:06', '1963-06-06', '1963', '06:06:06', '2001-01-01 06:06:06'),
+(6, '1993-06-06 06:06:06', '1993-06-06', '1993', '06:06:06', '2001-01-01 06:06:06'),
+(7, '2001-01-01 10:11:10', '2001-01-01', '2001', '10:11:10', '2001-01-01 10:11:10'),
+(8, '2001-01-01 10:11:11', '2001-01-01', '2001', '10:11:11', '2001-01-01 10:11:11'),
+(9, '2005-01-31 23:59:59', '2005-01-31', '2005', '23:59:59', '2001-01-01 23:59:59');
+select count(*)-9 from t1 use index (dt) where dt > '1900-01-01 00:00:00';
+count(*)-9
+0
+select count(*)-6 from t1 use index (dt) where dt >= '1955-12-31 00:00:00';
+count(*)-6
+0
+select count(*)-5 from t1 use index (dt) where dt > '1955-12-31 00:00:00';
+count(*)-5
+0
+select count(*)-5 from t1 use index (dt) where dt < '1970-03-03 22:22:22';
+count(*)-5
+0
+select count(*)-7 from t1 use index (dt) where dt < '2001-01-01 10:11:11';
+count(*)-7
+0
+select count(*)-8 from t1 use index (dt) where dt <= '2001-01-01 10:11:11';
+count(*)-8
+0
+select count(*)-9 from t1 use index (dt) where dt <= '2055-01-01 00:00:00';
+count(*)-9
+0
+select count(*)-9 from t1 use index (da) where da > '1900-01-01';
+count(*)-9
+0
+select count(*)-6 from t1 use index (da) where da >= '1955-12-31';
+count(*)-6
+0
+select count(*)-5 from t1 use index (da) where da > '1955-12-31';
+count(*)-5
+0
+select count(*)-5 from t1 use index (da) where da < '1970-03-03';
+count(*)-5
+0
+select count(*)-6 from t1 use index (da) where da < '2001-01-01';
+count(*)-6
+0
+select count(*)-8 from t1 use index (da) where da <= '2001-01-02';
+count(*)-8
+0
+select count(*)-9 from t1 use index (da) where da <= '2055-01-01';
+count(*)-9
+0
+select count(*)-9 from t1 use index (ye) where ye > '1900';
+count(*)-9
+0
+select count(*)-6 from t1 use index (ye) where ye >= '1955';
+count(*)-6
+0
+select count(*)-5 from t1 use index (ye) where ye > '1955';
+count(*)-5
+0
+select count(*)-5 from t1 use index (ye) where ye < '1970';
+count(*)-5
+0
+select count(*)-6 from t1 use index (ye) where ye < '2001';
+count(*)-6
+0
+select count(*)-8 from t1 use index (ye) where ye <= '2001';
+count(*)-8
+0
+select count(*)-9 from t1 use index (ye) where ye <= '2055';
+count(*)-9
+0
+select count(*)-9 from t1 use index (ti) where ti >= '00:00:00';
+count(*)-9
+0
+select count(*)-7 from t1 use index (ti) where ti > '00:00:00';
+count(*)-7
+0
+select count(*)-7 from t1 use index (ti) where ti > '05:05:05';
+count(*)-7
+0
+select count(*)-5 from t1 use index (ti) where ti > '06:06:06';
+count(*)-5
+0
+select count(*)-5 from t1 use index (ti) where ti < '10:11:11';
+count(*)-5
+0
+select count(*)-6 from t1 use index (ti) where ti <= '10:11:11';
+count(*)-6
+0
+select count(*)-8 from t1 use index (ti) where ti < '23:59:59';
+count(*)-8
+0
+select count(*)-9 from t1 use index (ti) where ti <= '23:59:59';
+count(*)-9
+0
+select count(*)-9 from t1 use index (ts) where ts >= '2001-01-01 00:00:00';
+count(*)-9
+0
+select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 00:00:00';
+count(*)-7
+0
+select count(*)-7 from t1 use index (ts) where ts > '2001-01-01 05:05:05';
+count(*)-7
+0
+select count(*)-5 from t1 use index (ts) where ts > '2001-01-01 06:06:06';
+count(*)-5
+0
+select count(*)-5 from t1 use index (ts) where ts < '2001-01-01 10:11:11';
+count(*)-5
+0
+select count(*)-6 from t1 use index (ts) where ts <= '2001-01-01 10:11:11';
+count(*)-6
+0
+select count(*)-8 from t1 use index (ts) where ts < '2001-01-01 23:59:59';
+count(*)-8
+0
+select count(*)-9 from t1 use index (ts) where ts <= '2001-01-01 23:59:59';
+count(*)-9
+0
+drop table t1;
+create table t1 (
+a int primary key,
+s decimal(12),
+t decimal(12, 5),
+u decimal(12) unsigned,
+v decimal(12, 5) unsigned,
+key (s),
+key (t),
+key (u),
+key (v)
+) engine=ndb;
+insert into t1 values
+( 0, -000000000007, -0000061.00003, 000000000061, 0000965.00042),
+( 1, -000000000007, -0000061.00042, 000000000061, 0000965.00003),
+( 2, -071006035767, 4210253.00024, 000000000001, 0000001.84488),
+( 3, 000000007115, 0000000.77607, 000077350625, 0000018.00013),
+( 4, -000000068391, -0346486.00000, 000000005071, 0005334.00002),
+( 5, -521579890459, -1936874.00001, 000000000154, 0000003.00018),
+( 6, -521579890459, -1936874.00018, 000000000154, 0000003.00001),
+( 7, 000000000333, 0000051.39140, 000000907958, 0788643.08374),
+( 8, 000042731229, 0000009.00000, 000000000009, 6428667.00000),
+( 9, -000008159769, 0000918.00004, 000096951421, 7607730.00008);
+select count(*)- 5 from t1 use index (s) where s < -000000000007;
+count(*)- 5
+0
+select count(*)- 7 from t1 use index (s) where s <= -000000000007;
+count(*)- 7
+0
+select count(*)- 2 from t1 use index (s) where s = -000000000007;
+count(*)- 2
+0
+select count(*)- 5 from t1 use index (s) where s >= -000000000007;
+count(*)- 5
+0
+select count(*)- 3 from t1 use index (s) where s > -000000000007;
+count(*)- 3
+0
+select count(*)- 4 from t1 use index (t) where t < -0000061.00003;
+count(*)- 4
+0
+select count(*)- 5 from t1 use index (t) where t <= -0000061.00003;
+count(*)- 5
+0
+select count(*)- 1 from t1 use index (t) where t = -0000061.00003;
+count(*)- 1
+0
+select count(*)- 6 from t1 use index (t) where t >= -0000061.00003;
+count(*)- 6
+0
+select count(*)- 5 from t1 use index (t) where t > -0000061.00003;
+count(*)- 5
+0
+select count(*)- 2 from t1 use index (u) where u < 000000000061;
+count(*)- 2
+0
+select count(*)- 4 from t1 use index (u) where u <= 000000000061;
+count(*)- 4
+0
+select count(*)- 2 from t1 use index (u) where u = 000000000061;
+count(*)- 2
+0
+select count(*)- 8 from t1 use index (u) where u >= 000000000061;
+count(*)- 8
+0
+select count(*)- 6 from t1 use index (u) where u > 000000000061;
+count(*)- 6
+0
+select count(*)- 5 from t1 use index (v) where v < 0000965.00042;
+count(*)- 5
+0
+select count(*)- 6 from t1 use index (v) where v <= 0000965.00042;
+count(*)- 6
+0
+select count(*)- 1 from t1 use index (v) where v = 0000965.00042;
+count(*)- 1
+0
+select count(*)- 5 from t1 use index (v) where v >= 0000965.00042;
+count(*)- 5
+0
+select count(*)- 4 from t1 use index (v) where v > 0000965.00042;
+count(*)- 4
+0
+drop table t1;
+create table t1(a int primary key, b int not null, index(b));
+insert into t1 values (1,1), (2,2);
+set autocommit=0;
+begin;
+select count(*) from t1;
+count(*)
+2
+ALTER TABLE t1 ADD COLUMN c int;
+select a from t1 where b = 2;
+a
+2
+show tables;
+Tables_in_test
+t1
+drop table t1;
diff --git a/mysql-test/r/ndb_index_unique.result b/mysql-test/r/ndb_index_unique.result
index f1407dfe78d..598b9dcccf7 100644
--- a/mysql-test/r/ndb_index_unique.result
+++ b/mysql-test/r/ndb_index_unique.result
@@ -22,7 +22,7 @@ select * from t1 where b = 4 order by a;
a b c
3 4 6
insert into t1 values(8, 2, 3);
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '8' for key 1
select * from t1 order by a;
a b c
1 2 3
@@ -44,6 +44,53 @@ a b c
7 8 3
8 2 3
drop table t1;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned,
+c int unsigned,
+UNIQUE bc(b,c)
+) engine = ndb;
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc)order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (bc) order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 use index (PRIMARY) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL order by a;
+a b c
+2 NULL 2
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c IS NULL order by a;
+a b c
+3 NULL NULL
+select * from t1 use index (bc) where b IS NULL and c = 2 order by a;
+a b c
+2 NULL 2
+select * from t1 use index (bc) where b < 4 order by a;
+a b c
+1 1 1
+select * from t1 use index (bc) where b IS NOT NULL order by a;
+a b c
+1 1 1
+4 4 NULL
+insert into t1 values(5,1,1);
+ERROR 23000: Duplicate entry '5' for key 1
+drop table t1;
CREATE TABLE t2 (
a int unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
@@ -65,7 +112,7 @@ select * from t2 where b = 4 order by a;
a b c
3 4 6
insert into t2 values(8, 2, 3);
-ERROR 23000: Can't write, because of unique constraint, to table 't2'
+ERROR 23000: Duplicate entry '8' for key 1
select * from t2 order by a;
a b c
1 2 3
@@ -87,6 +134,13 @@ a b c
7 8 3
8 2 3
drop table t2;
+CREATE TABLE t2 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned not null,
+c int unsigned,
+UNIQUE USING HASH (b, c)
+) engine=ndbcluster;
+ERROR 42000: Column 'c' is used with UNIQUE or INDEX but is not defined as NOT NULL
CREATE TABLE t3 (
a int unsigned NOT NULL,
b int unsigned not null,
@@ -123,7 +177,7 @@ pk a
3 NULL
4 4
insert into t1 values (5,0);
-ERROR 23000: Can't write, because of unique constraint, to table 't1'
+ERROR 23000: Duplicate entry '5' for key 1
select * from t1 order by pk;
pk a
-1 NULL
@@ -156,7 +210,7 @@ pk a b c
0 NULL 18 NULL
1 3 19 abc
insert into t2 values(2,3,19,'abc');
-ERROR 23000: Can't write, because of unique constraint, to table 't2'
+ERROR 23000: Duplicate entry '2' for key 1
select * from t2 order by pk;
pk a b c
-1 1 17 NULL
@@ -522,3 +576,53 @@ uid gid rid cid
1 1 2 3
1 1 2 4
drop table t1,t2,t3,t4,t5,t6,t7;
+CREATE TABLE t1 (
+a int unsigned NOT NULL PRIMARY KEY,
+b int unsigned,
+c int unsigned,
+UNIQUE bc(b,c) ) engine = ndb;
+insert into t1 values(1,1,1),(2,NULL,2),(3,NULL,NULL),(4,4,NULL);
+select * from t1 where b=1 and c=1;
+a b c
+1 1 1
+select * from t1 where b is null and c is null;
+a b c
+3 NULL NULL
+select * from t1 where b is null and c = 2;
+a b c
+2 NULL 2
+select * from t1 where b = 4 and c is null;
+a b c
+4 4 NULL
+create table t8 as
+select * from t1 where (b = 1 and c = 1)
+or (b is null and c is null)
+or (b is null and c = 2)
+or (b = 4 and c is null);
+select * from t8 order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+select * from t1 order by a;
+a b c
+1 1 1
+2 NULL 2
+3 NULL NULL
+4 4 NULL
+drop table t1, t8;
+create table t1(
+id integer not null auto_increment,
+month integer not null,
+year integer not null,
+code varchar( 2) not null,
+primary key ( id),
+unique idx_t1( month, code, year)
+) engine=ndb;
+INSERT INTO t1 (month, year, code) VALUES (4,2004,'12');
+INSERT INTO t1 (month, year, code) VALUES (5,2004,'12');
+select * from t1 where code = '12' and month = 4 and year = 2004 ;
+id month year code
+1 4 2004 12
+drop table t1;
diff --git a/mysql-test/r/ndb_insert.result b/mysql-test/r/ndb_insert.result
index cdc445558b9..7503010a66b 100644
--- a/mysql-test/r/ndb_insert.result
+++ b/mysql-test/r/ndb_insert.result
@@ -535,25 +535,73 @@ count(*)
2000
insert into t1 select * from t1 where b < 10 order by pk1;
ERROR 23000: Duplicate entry '9' for key 1
+DELETE FROM t1 WHERE pk1=2;
begin;
-INSERT IGNORE INTO t1 VALUES(1,2,3);
-ERROR HY000: Table storage engine for 't1' doesn't have this option
-commit;
-select * from t1 where pk1=1;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
pk1 b c
+0 0 0
1 1 1
-INSERT IGNORE INTO t1 VALUES(1,2,3);
-ERROR HY000: Table storage engine for 't1' doesn't have this option
-select * from t1 where pk1=1;
+2 3 4
+rollback;
+INSERT IGNORE INTO t1 VALUES(1,2,3),(2,3,4);
+select * from t1 where pk1 < 3 order by pk1;
pk1 b c
+0 0 0
1 1 1
-REPLACE INTO t1 values(1, 2, 3);
+2 3 4
+REPLACE INTO t1 values(1, 78, 3);
select * from t1 where pk1=1;
pk1 b c
-1 2 3
-INSERT INTO t1 VALUES(1,1,1) ON DUPLICATE KEY UPDATE b=79;
-ERROR HY000: Table storage engine for 't1' doesn't have this option
-select * from t1 where pk1=1;
+1 78 3
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=79;
+select * from t1 where pk1 < 4 order by pk1;
pk1 b c
-1 2 3
+0 0 0
+1 79 3
+2 3 4
+3 79 3
+INSERT INTO t1 VALUES(1,1,1),(3,4,5) ON DUPLICATE KEY UPDATE b=pk1+c;
+select * from t1 where pk1 < 4 order by pk1;
+pk1 b c
+0 0 0
+1 4 3
+2 3 4
+3 6 3
+DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
+INSERT INTO t1 VALUES(1,1,1),(2,2,17),(3,4,5) ON DUPLICATE KEY UPDATE pk1=b;
+select * from t1 where pk1 = b and b != c order by pk1;
+pk1 b c
+2 2 17
+4 4 3
+6 6 3
+DROP TABLE t1;
+CREATE TABLE t1(a INT) ENGINE=ndb;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 SELECT a FROM t1;
+INSERT IGNORE INTO t1 VALUES (1);
+INSERT IGNORE INTO t1 VALUES (1);
+SELECT * FROM t1;
+a
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
DROP TABLE t1;
diff --git a/mysql-test/r/ndb_restore.result b/mysql-test/r/ndb_restore.result
new file mode 100644
index 00000000000..8e4449b1996
--- /dev/null
+++ b/mysql-test/r/ndb_restore.result
@@ -0,0 +1,249 @@
+use test;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+CREATE TABLE `t1` (
+`capgoaledatta` smallint(5) unsigned NOT NULL auto_increment,
+`goaledatta` char(2) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+PRIMARY KEY (`capgoaledatta`,`goaledatta`,`maturegarbagefa`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES (2,'3','q3plus.qt'),(4,'4','q3plus.qt'),(1,'3','q3.net'),(3,'4','q3.net'),(3,'20','threetrees.qt');
+CREATE TABLE `t2` (
+`capgotod` smallint(5) unsigned NOT NULL auto_increment,
+`gotod` smallint(5) unsigned NOT NULL default '0',
+`goaledatta` char(2) default NULL,
+`maturegarbagefa` varchar(32) default NULL,
+`descrpooppo` varchar(64) default NULL,
+`svcutonsa` varchar(64) NOT NULL default '',
+PRIMARY KEY (`capgotod`),
+KEY `i_quadaddsvr` (`gotod`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t2` VALUES (5,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST');
+CREATE TABLE `t3` (
+`CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
+`capgotod` smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (`capgotod`,`CapGoaledatta`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t3` VALUES (5,3),(2,4),(5,4),(1,3);
+CREATE TABLE `t4` (
+`capfa` bigint(20) unsigned NOT NULL auto_increment,
+`realm` varchar(32) NOT NULL default '',
+`authpwchap` varchar(32) default NULL,
+`fa` varchar(32) NOT NULL default '',
+`payyingatta` tinyint(4) NOT NULL default '0',
+`status` char(1) default NULL,
+PRIMARY KEY (`fa`,`realm`),
+KEY `capfa` (`capfa`),
+KEY `i_quadentity` (`fa`,`realm`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t4` VALUES (18,'john.smith','q3.net','dessjohn.smith',0,NULL),(21,'quad_katt_with_brandtad','q3.net','acne',0,NULL),(22,'quad_katt_carattoaa','q3.net','acne',0,NULL),(26,'436462612809','sqasdt.q3.net','N/A',0,'6'),(19,'john','smith.qt','dessjohn',0,NULL),(33,'436643196120','sqasdt.q3.net','N/A',1,'6'),(28,'436642900019','sqasdt.q3.net','N/A',0,'6'),(30,'436462900209','sqasdt.q3.net','N/A',0,'6'),(16,'436640006666','sqasdt.q3.net','',0,NULL),(19,'dette','el-redun.com','dessdette',0,NULL),(12,'quad_kattPP','q3.net','acne',2,NULL),(14,'436640008888','sqasdt.q3.net','',0,NULL),(29,'463624900028','sqasdt.q3.net','N/A',0,'6'),(15,'436640099099','sqasdt.q3.net','',0,NULL),(13,'pap','q3plus.qt','acne',1,NULL),(19,'436642612091','sqasdt.q3.net','N/A',0,'6'),(12,'quad_katt','q3.net','acne',0,NULL),(11,'quad_kattVK','q3.net','acne',1,NULL),(32,'463641969502','sqasdt.q3.net','N/A',1,'6'),(20,'joe','q3.net','joedesswd',0,NULL),(29,'436642900034','sqasdt.q3.net','N/A',0,'6'),(25,'contind','armerde.qt','acne',1,NULL);
+CREATE TABLE `t5` (
+`capfa` bigint(20) unsigned NOT NULL default '0',
+`gotod` smallint(5) unsigned NOT NULL default '0',
+`orderutonsa` varchar(64) NOT NULL default '',
+PRIMARY KEY (`capfa`,`gotod`,`orderutonsa`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t5` VALUES (21,2,''),(21,1,''),(22,4,'');
+CREATE TABLE `t6` (
+`capfa_parent` bigint(20) unsigned NOT NULL default '0',
+`capfa_child` bigint(20) unsigned NOT NULL default '0',
+`relatta` smallint(5) unsigned NOT NULL default '0',
+PRIMARY KEY (`capfa_child`,`capfa_parent`,`relatta`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t6` VALUES (15,16,0),(19,20,0),(18326932092909551615,30,0),(26,29,0),(18326932092909551615,29,0),(19,18,0),(26,28,0),(12,14,0);
+CREATE TABLE `t7` (
+`dardpo` char(15) NOT NULL default '',
+`dardtestard` tinyint(3) unsigned NOT NULL default '0',
+`FastFA` char(5) NOT NULL default '',
+`FastCode` char(6) NOT NULL default '',
+`Fastca` char(1) NOT NULL default '',
+`Fastmag` char(1) NOT NULL default '',
+`Beareratta` char(2) NOT NULL default '',
+PRIMARY KEY (`dardpo`,`dardtestard`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t7` VALUES ('2.6.2.4',24,'CECHP','54545','0','0','5'),('2.2.5.4',26,'CANFA','33223','1','1','4'),('4.3.2.4',28,'ITALD','54222','1','0','5'),('129..0.0.eins',28,'G','99999','1','1','5'),('1.1.1.1',24,'AUTPT','32323','0','1','3');
+CREATE TABLE `t8` (
+`kattjame` varchar(32) NOT NULL default '',
+`realm` varchar(32) NOT NULL default '',
+`realm_entered` varchar(32) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+`kattjame_entered` varchar(32) NOT NULL default '',
+`hunderaaarbagefa` varchar(32) NOT NULL default '',
+`gest` varchar(16) default NULL,
+`hassetino` varchar(16) NOT NULL default '',
+`aaaproxysessfa` varchar(255) default NULL,
+`autologonallowed` char(1) default NULL,
+`squardporoot` varchar(15) NOT NULL default '',
+`naspo` varchar(15) default NULL,
+`beareratta` char(2) default NULL,
+`fastCode` varchar(6) default NULL,
+`fastFA` varchar(5) default NULL,
+`fastca` char(1) default NULL,
+`fastmag` char(1) default NULL,
+`lastupdate` datetime default NULL,
+`hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+`accthassetitime` int(10) unsigned default NULL,
+`acctoutputoctets` bigint(20) unsigned default NULL,
+`acctinputoctets` bigint(20) unsigned default NULL,
+PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`),
+KEY `squardporoot` (`squardporoot`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t8` VALUES ('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643196120','436643196929','8956234534568968','5524595699','uxasmt21.net.acne.qt/481889229462692422','','1.1.1.1','2.2.4.6','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565),('4545435545','john','q3.net','q3.net','acne.li','436643196120','436643196929','45345234568968','995696699','uxasmt21.net.acne.qt/481889229462692423','','1.1.1.1','2.2.9.8','2','86989','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8821923,169,3565),('versteckter_q3net_katt','joe','q3.net','elredun.com','q3.net','436643196120','436643196939','91341234568968','695595699','uxasmt21.net.acne.qt/481889229462692421','','1.1.1.1','2.5.2.5','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',1923123,9569,6565);
+CREATE TABLE `t9` (
+`kattjame` varchar(32) NOT NULL default '',
+`kattjame_entered` varchar(32) NOT NULL default '',
+`realm` varchar(32) NOT NULL default '',
+`realm_entered` varchar(32) NOT NULL default '',
+`maturegarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa` varchar(32) NOT NULL default '',
+`hunderaaarbagefa_parent` varchar(32) NOT NULL default '',
+`gest` varchar(16) default NULL,
+`hassetino` varchar(16) NOT NULL default '',
+`squardporoot` varchar(15) NOT NULL default '',
+`naspo` varchar(15) default NULL,
+`beareratta` char(2) default NULL,
+`fastCode` varchar(6) default NULL,
+`fastFA` varchar(5) default NULL,
+`fastca` char(1) default NULL,
+`fastmag` char(1) default NULL,
+`lastupdate` datetime default NULL,
+`hassetistart` datetime NOT NULL default '0000-00-00 00:00:00',
+`accthassetitime` int(10) unsigned default NULL,
+`actcoutpuocttets` bigint(20) unsigned default NULL,
+`actinputocctets` bigint(20) unsigned default NULL,
+`terminateraste` tinyint(3) unsigned default NULL,
+PRIMARY KEY (`kattjame`,`hunderaaarbagefa`,`hassetistart`,`hassetino`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+INSERT INTO `t9` VALUES ('3g4jh8gar2t','joe','q3.net','elredun.com','q3.net','436643316120','436643316939','91341234568968','695595699','1.1.1.1','2.2.6.2','3','86989','34','x','x','2012-03-12 18:35:04','2012-12-05 12:35:04',3123123,9569,6565,1),('4tt45345235','pap','q3plus.qt','q3plus.qt','q3.net','436643316120','436643316939','8956234534568968','5254595969','1.1.1.1','8.6.2.2','4','86989','34','x','x','2012-03-12 12:55:34','2012-12-05 11:20:04',3223433,3369,9565,2),('4545435545','john','q3.net','q3.net','acne.li','436643316120','436643316939','45345234568968','995696699','1.1.1.1','2.9.9.2','2','86998','34','x','x','2012-03-12 11:35:03','2012-12-05 08:50:04',8823123,169,3565,3);
+create table t1_c engine=ndbcluster as select * from t1;
+create table t2_c engine=ndbcluster as select * from t2;
+create table t3_c engine=ndbcluster as select * from t3;
+create table t4_c engine=ndbcluster as select * from t4;
+create table t5_c engine=ndbcluster as select * from t5;
+create table t6_c engine=ndbcluster as select * from t6;
+create table t7_c engine=ndbcluster as select * from t7;
+create table t8_c engine=ndbcluster as select * from t8;
+create table t9_c engine=ndbcluster as select * from t9;
+drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
+show tables;
+Tables_in_test
+t1
+t2
+t3
+t4
+t5
+t6
+t7
+t8
+t9
+t8_c
+t9_c
+t1_c
+t7_c
+t6_c
+t5_c
+t4_c
+t3_c
+t2_c
+select count(*) from t1;
+count(*)
+5
+select count(*) from t1_c;
+count(*)
+5
+select count(*)
+from (select * from t1 union
+select * from t1_c) a;
+count(*)
+5
+select count(*) from t2;
+count(*)
+6
+select count(*) from t2_c;
+count(*)
+6
+select count(*)
+from (select * from t2 union
+select * from t2_c) a;
+count(*)
+6
+select count(*) from t3;
+count(*)
+4
+select count(*) from t3_c;
+count(*)
+4
+select count(*)
+from (select * from t3 union
+select * from t3_c) a;
+count(*)
+4
+select count(*) from t4;
+count(*)
+22
+select count(*) from t4_c;
+count(*)
+22
+select count(*)
+from (select * from t4 union
+select * from t4_c) a;
+count(*)
+22
+select count(*) from t5;
+count(*)
+3
+select count(*) from t5_c;
+count(*)
+3
+select count(*)
+from (select * from t5 union
+select * from t5_c) a;
+count(*)
+3
+select count(*) from t6;
+count(*)
+8
+select count(*) from t6_c;
+count(*)
+8
+select count(*)
+from (select * from t6 union
+select * from t6_c) a;
+count(*)
+8
+select count(*) from t7;
+count(*)
+5
+select count(*) from t7_c;
+count(*)
+5
+select count(*)
+from (select * from t7 union
+select * from t7_c) a;
+count(*)
+5
+select count(*) from t8;
+count(*)
+3
+select count(*) from t8_c;
+count(*)
+3
+select count(*)
+from (select * from t8 union
+select * from t8_c) a;
+count(*)
+3
+select count(*) from t9;
+count(*)
+3
+select count(*) from t9_c;
+count(*)
+3
+select count(*)
+from (select * from t9 union
+select * from t9_c) a;
+count(*)
+3
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop table if exists t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c;
diff --git a/mysql-test/r/ndb_update.result b/mysql-test/r/ndb_update.result
new file mode 100644
index 00000000000..5df5c861cfb
--- /dev/null
+++ b/mysql-test/r/ndb_update.result
@@ -0,0 +1,13 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (
+pk1 INT NOT NULL PRIMARY KEY,
+b INT NOT NULL,
+c INT NOT NULL
+) ENGINE=ndbcluster;
+INSERT INTO t1 VALUES (0, 0, 1),(1,1,2),(2,2,3);
+UPDATE t1 set b = c;
+select * from t1 order by pk1;
+pk1 b c
+0 1 1
+1 2 2
+2 3 3
diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result
index bd90b3fe3f3..3e233eb512a 100644
--- a/mysql-test/r/null.result
+++ b/mysql-test/r/null.result
@@ -175,3 +175,97 @@ explain select * from t1 where i=2 or i is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref i i 4 const 7 Using where; Using index
drop table t1;
+set names latin2;
+create table t1 select
+null as c00,
+if(1, null, 'string') as c01,
+if(0, null, 'string') as c02,
+ifnull(null, 'string') as c03,
+ifnull('string', null) as c04,
+case when 0 then null else 'string' end as c05,
+case when 1 then null else 'string' end as c06,
+coalesce(null, 'string') as c07,
+coalesce('string', null) as c08,
+least('string',null) as c09,
+least(null, 'string') as c10,
+greatest('string',null) as c11,
+greatest(null, 'string') as c12,
+nullif('string', null) as c13,
+nullif(null, 'string') as c14,
+trim('string' from null) as c15,
+trim(null from 'string') as c16,
+substring_index('string', null, 1) as c17,
+substring_index(null, 'string', 1) as c18,
+elt(1, null, 'string') as c19,
+elt(1, 'string', null) as c20,
+concat('string', null) as c21,
+concat(null, 'string') as c22,
+concat_ws('sep', 'string', null) as c23,
+concat_ws('sep', null, 'string') as c24,
+concat_ws(null, 'string', 'string') as c25,
+make_set(3, 'string', null) as c26,
+make_set(3, null, 'string') as c27,
+export_set(3, null, 'off', 'sep') as c29,
+export_set(3, 'on', null, 'sep') as c30,
+export_set(3, 'on', 'off', null) as c31,
+replace(null, 'from', 'to') as c32,
+replace('str', null, 'to') as c33,
+replace('str', 'from', null) as c34,
+insert('str', 1, 2, null) as c35,
+insert(null, 1, 2, 'str') as c36,
+lpad('str', 10, null) as c37,
+rpad(null, 10, 'str') as c38;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c00` binary(0) default NULL,
+ `c01` varchar(6) character set latin2 default NULL,
+ `c02` varchar(6) character set latin2 default NULL,
+ `c03` varchar(6) character set latin2 NOT NULL default '',
+ `c04` varchar(6) character set latin2 default NULL,
+ `c05` varchar(6) character set latin2 default NULL,
+ `c06` varchar(6) character set latin2 default NULL,
+ `c07` varchar(6) character set latin2 default NULL,
+ `c08` varchar(6) character set latin2 default NULL,
+ `c09` varchar(6) character set latin2 NOT NULL default '',
+ `c10` varchar(6) character set latin2 NOT NULL default '',
+ `c11` varchar(6) character set latin2 NOT NULL default '',
+ `c12` varchar(6) character set latin2 NOT NULL default '',
+ `c13` varchar(6) character set latin2 default NULL,
+ `c14` char(0) character set latin2 default NULL,
+ `c15` char(0) character set latin2 default NULL,
+ `c16` varchar(6) character set latin2 default NULL,
+ `c17` varchar(6) character set latin2 default NULL,
+ `c18` char(0) character set latin2 default NULL,
+ `c19` varchar(6) character set latin2 default NULL,
+ `c20` varchar(6) character set latin2 default NULL,
+ `c21` varchar(6) character set latin2 default NULL,
+ `c22` varchar(6) character set latin2 default NULL,
+ `c23` varchar(9) character set latin2 default NULL,
+ `c24` varchar(9) character set latin2 default NULL,
+ `c25` varchar(12) character set latin2 default NULL,
+ `c26` varchar(7) character set latin2 default NULL,
+ `c27` varchar(7) character set latin2 default NULL,
+ `c29` longtext character set latin2,
+ `c30` longtext character set latin2,
+ `c31` varchar(192) character set latin2 default NULL,
+ `c32` char(0) character set latin2 default NULL,
+ `c33` char(3) character set latin2 default NULL,
+ `c34` char(3) character set latin2 default NULL,
+ `c35` char(3) character set latin2 default NULL,
+ `c36` char(3) character set latin2 default NULL,
+ `c37` varchar(10) character set latin2 default NULL,
+ `c38` varchar(10) character set latin2 default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select
+case 'str' when 'STR' then 'str' when null then 'null' end as c01,
+case 'str' when null then 'null' when 'STR' then 'str' end as c02,
+field(null, 'str1', 'str2') as c03,
+field('str1','STR1', null) as c04,
+field('str1', null, 'STR1') as c05,
+'string' in ('STRING', null) as c08,
+'string' in (null, 'STRING') as c09;
+c01 c02 c03 c04 c05 c08 c09
+str str 0 1 2 1 1
+set names latin1;
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index a87d0c33559..f7cb17a1a74 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -2,9 +2,9 @@ drop table if exists t1;
create table t1(f1 int);
insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL;
-grant select on test.* to ssl_user2@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
-grant select on test.* to ssl_user3@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
-grant select on test.* to ssl_user4@localhost require cipher "EDH-RSA-DES-CBC3-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA";
+grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
+grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges;
select * from t1;
f1
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 94d56bbc2fa..ee8ca5f0328 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -733,3 +733,58 @@ xxxxxxxxxxxxxxxxxxxaa
xxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxz
drop table t1;
+create table t1 (
+`sid` decimal(8,0) default null,
+`wnid` varchar(11) not null default '',
+key `wnid14` (`wnid`(4)),
+key `wnid` (`wnid`)
+) engine=myisam default charset=latin1;
+insert into t1 (`sid`, `wnid`) values
+('10100','01019000000'),('37986','01019000000'),('37987','01019010000'),
+('39560','01019090000'),('37989','01019000000'),('37990','01019011000'),
+('37991','01019011000'),('37992','01019019000'),('37993','01019030000'),
+('37994','01019090000'),('475','02070000000'),('25253','02071100000'),
+('25255','02071100000'),('25256','02071110000'),('25258','02071130000'),
+('25259','02071190000'),('25260','02071200000'),('25261','02071210000'),
+('25262','02071290000'),('25263','02071300000'),('25264','02071310000'),
+('25265','02071310000'),('25266','02071320000'),('25267','02071320000'),
+('25269','02071330000'),('25270','02071340000'),('25271','02071350000'),
+('25272','02071360000'),('25273','02071370000'),('25281','02071391000'),
+('25282','02071391000'),('25283','02071399000'),('25284','02071400000'),
+('25285','02071410000'),('25286','02071410000'),('25287','02071420000'),
+('25288','02071420000'),('25291','02071430000'),('25290','02071440000'),
+('25292','02071450000'),('25293','02071460000'),('25294','02071470000'),
+('25295','02071491000'),('25296','02071491000'),('25297','02071499000');
+explain select * from t1 where wnid like '0101%' order by wnid;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range wnid14,wnid wnid 11 NULL 10 Using where
+select * from t1 where wnid like '0101%' order by wnid;
+sid wnid
+10100 01019000000
+37986 01019000000
+37989 01019000000
+37987 01019010000
+37990 01019011000
+37991 01019011000
+37992 01019019000
+37993 01019030000
+39560 01019090000
+37994 01019090000
+drop table t1;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (2), (1), (1), (2), (1);
+SELECT a FROM t1 ORDER BY a;
+a
+1
+1
+1
+2
+2
+(SELECT a FROM t1) ORDER BY a;
+a
+1
+1
+1
+2
+2
+DROP TABLE t1;
diff --git a/mysql-test/r/preload.result b/mysql-test/r/preload.result
index f0b99a8d6f1..7237a0da7e0 100644
--- a/mysql-test/r/preload.result
+++ b/mysql-test/r/preload.result
@@ -74,15 +74,15 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 581
+Key_reads 581
select count(*) from t1 where b = 'test1';
count(*)
4181
show status like "key_read%";
Variable_name Value
-Key_read_requests 217
-Key_reads 45
+Key_read_requests 798
+Key_reads 581
flush tables;
flush status;
show status like "key_read%";
@@ -98,15 +98,15 @@ Table Op Msg_type Msg_text
test.t1 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 10
+Key_reads 10
select count(*) from t1 where b = 'test1';
count(*)
4181
show status like "key_read%";
Variable_name Value
-Key_read_requests 217
-Key_reads 45
+Key_read_requests 227
+Key_reads 52
flush tables;
flush status;
show status like "key_read%";
@@ -123,8 +123,8 @@ test.t1 preload_keys status OK
test.t2 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 587
+Key_reads 587
select count(*) from t1 where b = 'test1';
count(*)
4181
@@ -133,8 +133,8 @@ count(*)
2584
show status like "key_read%";
Variable_name Value
-Key_read_requests 351
-Key_reads 73
+Key_read_requests 938
+Key_reads 613
flush tables;
flush status;
show status like "key_read%";
@@ -147,8 +147,8 @@ test.t3 preload_keys error Table 'test.t3' doesn't exist
test.t2 preload_keys status OK
show status like "key_read%";
Variable_name Value
-Key_read_requests 0
-Key_reads 0
+Key_read_requests 355
+Key_reads 355
flush tables;
flush status;
show status like "key_read%";
diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result
index 8c55bb08249..4e1e75f1b33 100644
--- a/mysql-test/r/ps.result
+++ b/mysql-test/r/ps.result
@@ -106,12 +106,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
set @fvar= 123.4567;
prepare stmt1 from @fvar;
ERROR 42000: 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 '123.4567' at line 1
-set @str1 = 'select ?';
-set @str2 = convert(@str1 using ucs2);
-prepare stmt1 from @str2;
-execute stmt1 using @ivar;
-?
-1234
drop table t1,t2;
PREPARE stmt1 FROM "select _utf8 'A' collate utf8_bin = ?";
set @var='A';
@@ -456,3 +450,35 @@ PREPARE stmt FROM 'UPDATE t1 AS P1 INNER JOIN (SELECT N FROM t1 GROUP BY N HAVIN
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
+prepare stmt from "select ? is null, ? is not null, ?";
+select @no_such_var is null, @no_such_var is not null, @no_such_var;
+@no_such_var is null @no_such_var is not null @no_such_var
+1 0 NULL
+execute stmt using @no_such_var, @no_such_var, @no_such_var;
+? is null ? is not null ?
+1 0 NULL
+set @var='abc';
+select @var is null, @var is not null, @var;
+@var is null @var is not null @var
+0 1 abc
+execute stmt using @var, @var, @var;
+? is null ? is not null ?
+0 1 abc
+set @var=null;
+select @var is null, @var is not null, @var;
+@var is null @var is not null @var
+1 0 NULL
+execute stmt using @var, @var, @var;
+? is null ? is not null ?
+1 0 NULL
+create table t1 (pnum char(3));
+create table t2 (pnum char(3));
+prepare stmt from "select pnum from t2 having pnum in (select 'p1' from t1)";
+execute stmt;
+pnum
+execute stmt;
+pnum
+execute stmt;
+pnum
+deallocate prepare stmt;
+drop table t1, t2;
diff --git a/mysql-test/r/ps_10nestset.result b/mysql-test/r/ps_10nestset.result
index 68f58a03674..ff63485a5f9 100644
--- a/mysql-test/r/ps_10nestset.result
+++ b/mysql-test/r/ps_10nestset.result
@@ -62,4 +62,15 @@ id emp salary l r
4 Donna 1064.80 5 6
5 Eddie 931.70 7 8
6 Fred 798.60 9 10
+prepare st_round from 'update t1 set salary = salary + ? - ( salary MOD ? )';
+set @arg_round= 50;
+execute st_round using @arg_round, @arg_round;
+select * from t1;
+id emp salary l r
+1 Jerry 1350.00 1 12
+2 Bert 1200.00 2 3
+3 Chuck 1250.00 4 11
+4 Donna 1100.00 5 6
+5 Eddie 950.00 7 8
+6 Fred 800.00 9 10
drop table t1;
diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result
index ccf2945d488..ec4aa528a7f 100644
--- a/mysql-test/r/ps_1general.result
+++ b/mysql-test/r/ps_1general.result
@@ -1,4 +1,6 @@
-use test;
+drop table if exists t5, t6, t7, t8;
+drop database if exists mysqltest ;
+drop database if exists client_test_db;
test_sequence
------ basic tests ------
drop table if exists t1, t9 ;
@@ -290,7 +292,7 @@ execute stmt4;
prepare stmt4 from ' show full processlist ';
execute stmt4;
Id User Host db Command Time State Info
-number root localhost test Query 0 NULL show full processlist
+number root localhost test Query time NULL show full processlist
prepare stmt4 from ' show grants for user ';
prepare stmt4 from ' show create table t2 ';
ERROR HY000: This command is not supported in the prepared statement protocol yet
@@ -467,15 +469,15 @@ ERROR HY000: This command is not supported in the prepared statement protocol ye
prepare stmt1 from ' explain select a from t1 order by b ';
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 14 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
@@ -483,15 +485,15 @@ SET @arg00=1 ;
prepare stmt1 from ' explain select a from t1 where a > ? order by b ';
execute stmt1 using @arg00;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 5 N 1 31 8
def possible_keys 253 4096 7 Y 0 31 8
def key 253 64 7 Y 0 31 8
-def key_len 8 3 1 Y 32800 0 8
+def key_len 8 3 1 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 27 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 Using where; Using filesort
@@ -558,7 +560,6 @@ execute stmt3;
ERROR 42S01: Table 'new_t2' already exists
rename table new_t2 to t2;
drop table t2;
-drop table if exists t5, t6, t7, t8 ;
prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
execute stmt1 ;
@@ -810,46 +811,49 @@ test_sequence
------ grant/revoke/drop affects a parallel session test ------
show grants for second_user@localhost ;
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
-grant usage on test.* to second_user@localhost
+create database mysqltest;
+use mysqltest;
+use test;
+grant usage on mysqltest.* to second_user@localhost
identified by 'looser' ;
-grant select on test.t9 to second_user@localhost
+grant select on mysqltest.t9 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
select current_user();
current_user()
second_user@localhost
show grants for current_user();
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
prepare s_t9 from 'select c1 as my_col
from t9 where c1= 1' ;
execute s_t9 ;
my_col
1
select a as my_col from t1;
-ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
-grant select on test.t1 to second_user@localhost
+ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
+grant select on mysqltest.t1 to second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
-drop table t9 ;
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
+drop table mysqltest.t9 ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t1` TO 'second_user'@'localhost'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
prepare s_t1 from 'select a as my_col from t1' ;
execute s_t1 ;
my_col
@@ -858,19 +862,19 @@ my_col
3
4
execute s_t9 ;
-ERROR 42S02: Table 'test.t9' doesn't exist
-revoke all privileges on test.t1 from second_user@localhost
+ERROR 42S02: Table 'mysqltest.t9' doesn't exist
+revoke all privileges on mysqltest.t1 from second_user@localhost
identified by 'looser' ;
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
show grants for second_user@localhost ;
Grants for second_user@localhost
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
-GRANT SELECT ON `test`.`t9` TO 'second_user'@'localhost'
+GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
execute s_t1 ;
-ERROR 42000: select command denied to user 'second_user'@'localhost' for table 't1'
+ERROR 42000: SELECT command denied to user 'second_user'@'localhost' for table 't1'
revoke all privileges, grant option from second_user@localhost ;
show grants for second_user@localhost ;
Grants for second_user@localhost
@@ -879,4 +883,5 @@ drop user second_user@localhost ;
commit ;
show grants for second_user@localhost ;
ERROR 42000: There is no such grant defined for user 'second_user' on host 'localhost'
-drop table t1 ;
+drop table t1,t9 ;
+drop database mysqltest;
diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result
index 40b2516f0b9..a27b8b996cd 100644
--- a/mysql-test/r/ps_2myisam.result
+++ b/mysql-test/r/ps_2myisam.result
@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@@ -1581,7 +1581,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1686,6 +1688,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;
@@ -1788,10 +1793,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1818,10 +1823,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1939,7 +1944,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1974,19 +1979,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2036,7 +2041,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2064,19 +2069,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2124,7 +2129,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2156,19 +2161,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2214,7 +2219,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2240,19 +2245,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -3022,7 +3027,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result
index 11669b131a7..eb17d25e80c 100644
--- a/mysql-test/r/ps_3innodb.result
+++ b/mysql-test/r/ps_3innodb.result
@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@@ -1564,7 +1564,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1669,6 +1671,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;
@@ -1771,10 +1776,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1801,10 +1806,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1922,7 +1927,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1957,19 +1962,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2019,7 +2024,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2047,19 +2052,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2107,7 +2112,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2139,19 +2144,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2197,7 +2202,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2223,19 +2228,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -3005,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result
index a3837650e0e..b53ad7e2409 100644
--- a/mysql-test/r/ps_4heap.result
+++ b/mysql-test/r/ps_4heap.result
@@ -1146,15 +1146,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@@ -1565,7 +1565,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1670,6 +1672,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;
@@ -1772,10 +1777,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1802,10 +1807,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1923,7 +1928,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1958,19 +1963,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2020,7 +2025,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2048,19 +2053,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2108,7 +2113,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2140,19 +2145,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2198,7 +2203,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 0 31 8
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2224,19 +2229,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
-def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
-def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
-def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
-def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
+def @arg23 254 8192 0 Y 0 31 8
+def @arg24 254 8192 0 Y 0 31 8
+def @arg25 254 8192 0 Y 0 31 8
+def @arg26 254 8192 0 Y 0 31 8
+def @arg27 254 8192 0 Y 0 31 8
+def @arg28 254 8192 0 Y 0 31 8
+def @arg29 254 8192 0 Y 0 31 8
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -3006,7 +3011,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result
index 619b59e4e3d..13227eb533b 100644
--- a/mysql-test/r/ps_5merge.result
+++ b/mysql-test/r/ps_5merge.result
@@ -1188,15 +1188,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@@ -1607,7 +1607,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1711,10 +1713,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1741,10 +1743,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1862,7 +1864,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1897,19 +1899,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -1959,7 +1961,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -1987,19 +1989,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2047,7 +2049,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2079,19 +2081,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2137,7 +2139,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2163,19 +2165,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2945,7 +2947,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
@@ -4196,15 +4198,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@@ -4615,7 +4617,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -4719,10 +4723,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -4749,10 +4753,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -4870,7 +4874,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -4905,19 +4909,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -4967,7 +4971,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -4995,19 +4999,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -5055,7 +5059,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5087,19 +5091,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -5145,7 +5149,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -5171,19 +5175,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -5953,7 +5957,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
diff --git a/mysql-test/r/ps_6bdb.result b/mysql-test/r/ps_6bdb.result
index 5c23a574f51..8630ba2db9b 100644
--- a/mysql-test/r/ps_6bdb.result
+++ b/mysql-test/r/ps_6bdb.result
@@ -1145,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 3
@@ -1564,7 +1564,9 @@ a b
1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1669,6 +1671,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;
@@ -1771,10 +1776,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1801,10 +1806,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1922,7 +1927,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1957,19 +1962,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -2019,7 +2024,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2047,19 +2052,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2107,7 +2112,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2139,19 +2144,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2197,7 +2202,7 @@ def @arg28 254 8192 10 Y 0 31 8
def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2223,19 +2228,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -3005,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result
index cf567750b85..43ff9607c55 100644
--- a/mysql-test/r/ps_7ndb.result
+++ b/mysql-test/r/ps_7ndb.result
@@ -2,20 +2,19 @@ use test;
drop table if exists t1, t9 ;
create table t1
(
-a int not null, b varchar(30),
+a int, b varchar(30),
primary key(a)
) engine = 'NDB' ;
-drop table if exists t9;
create table t9
(
-c1 tinyint not null, c2 smallint, c3 mediumint, c4 int,
+c1 tinyint, c2 smallint, c3 mediumint, c4 int,
c5 integer, c6 bigint, c7 float, c8 double,
c9 double precision, c10 real, c11 decimal(7, 4), c12 numeric(8, 4),
c13 date, c14 datetime, c15 timestamp(14), c16 time,
c17 year, c18 bit, c19 bool, c20 char,
-c21 char(10), c22 varchar(30), c23 char(100), c24 char(100),
-c25 char(100), c26 char(100), c27 char(100), c28 char(100),
-c29 char(100), c30 char(100), c31 enum('one', 'two', 'three'),
+c21 char(10), c22 varchar(30), c23 tinyblob, c24 tinytext,
+c25 blob, c26 text, c27 mediumblob, c28 mediumtext,
+c29 longblob, c30 longtext, c31 enum('one', 'two', 'three'),
c32 set('monday', 'tuesday', 'wednesday'),
primary key(c1)
) engine = 'NDB' ;
@@ -72,14 +71,14 @@ def test t9 t9 c19 c19 1 1 1 Y 32768 0 63
def test t9 t9 c20 c20 254 1 1 Y 0 0 8
def test t9 t9 c21 c21 253 10 10 Y 0 0 8
def test t9 t9 c22 c22 253 30 30 Y 0 0 8
-def test t9 t9 c23 c23 253 100 8 Y 0 0 8
-def test t9 t9 c24 c24 253 100 8 Y 0 0 8
-def test t9 t9 c25 c25 253 100 4 Y 0 0 8
-def test t9 t9 c26 c26 253 100 4 Y 0 0 8
-def test t9 t9 c27 c27 253 100 10 Y 0 0 8
-def test t9 t9 c28 c28 253 100 10 Y 0 0 8
-def test t9 t9 c29 c29 253 100 8 Y 0 0 8
-def test t9 t9 c30 c30 253 100 8 Y 0 0 8
+def test t9 t9 c23 c23 252 255 8 Y 144 0 63
+def test t9 t9 c24 c24 252 255 8 Y 16 0 8
+def test t9 t9 c25 c25 252 65535 4 Y 144 0 63
+def test t9 t9 c26 c26 252 65535 4 Y 16 0 8
+def test t9 t9 c27 c27 252 16777215 10 Y 144 0 63
+def test t9 t9 c28 c28 252 16777215 10 Y 16 0 8
+def test t9 t9 c29 c29 252 16777215 8 Y 144 0 63
+def test t9 t9 c30 c30 252 16777215 8 Y 16 0 8
def test t9 t9 c31 c31 254 5 3 Y 256 0 8
def test t9 t9 c32 c32 254 24 7 Y 2048 0 8
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32
@@ -1146,15 +1145,15 @@ test_sequence
prepare stmt1 from ' explain select * from t9 ' ;
execute stmt1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
-def id 8 3 1 N 32801 0 8
+def id 8 3 1 N 32929 0 63
def select_type 253 19 6 N 1 31 8
def table 253 64 2 N 1 31 8
def type 253 10 3 N 1 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
-def key_len 8 3 0 Y 32800 0 8
+def key_len 8 3 0 Y 32928 0 63
def ref 253 1024 0 Y 0 31 8
-def rows 8 10 1 N 32801 0 8
+def rows 8 10 1 N 32929 0 63
def Extra 253 255 0 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t9 ALL NULL NULL NULL NULL 2
@@ -1188,7 +1187,7 @@ c29= 'longblob', c30= 'longtext', c31='two', c32= 'tuesday';
commit ;
prepare stmt1 from 'delete from t1 where a=2' ;
execute stmt1;
-select a,b from t1 where a=2 order by b;
+select a,b from t1 where a=2;
a b
execute stmt1;
insert into t1 values(0,NULL);
@@ -1270,18 +1269,23 @@ execute stmt1 using @arg00, @arg00;
select a,b from t1 where a=@arg00;
a b
2 two
+execute stmt1 using @arg01, @arg00;
select a,b from t1 where a=@arg01;
a b
+22 two
execute stmt1 using @arg00, @arg01;
select a,b from t1 where a=@arg00;
a b
2 two
set @arg00=NULL;
set @arg01=2;
+execute stmt1 using @arg00, @arg01;
+Warnings:
+Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1
select a,b from t1 order by a;
a b
+0 two
1 one
-2 two
3 three
4 four
set @arg00=0;
@@ -1302,15 +1306,19 @@ create table t2 as select a,b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
+23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
-affected rows: 0
-info: Rows matched: 0 Changed: 0 Warnings: 0
-select a,b from t1 order by a;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
+select a,b from t1 order by a ;
a b
1 one
2 two
@@ -1319,21 +1327,25 @@ a b
drop table t2 ;
create table t2
(
-a int not null, b varchar(30),
+a int, b varchar(30),
primary key(a)
) engine = 'NDB' ;
insert into t2(a,b) select a, b from t1 ;
prepare stmt1 from 'update t1 set a=? where b=?
and a in (select ? from t2
where b = ? or a = ?)';
+execute stmt1 using @arg00, @arg01, @arg02, @arg03, @arg04 ;
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 where a = @arg00 ;
a b
+23 two
prepare stmt1 from 'update t1 set a=? where b=?
and a not in (select ? from t2
where b = ? or a = ?)';
execute stmt1 using @arg04, @arg01, @arg02, @arg03, @arg00 ;
-affected rows: 0
-info: Rows matched: 0 Changed: 0 Warnings: 0
+affected rows: 1
+info: Rows matched: 1 Changed: 1 Warnings: 0
select a,b from t1 order by a ;
a b
1 one
@@ -1474,7 +1486,7 @@ set @arg02=82 ;
set @arg03='8-2' ;
prepare stmt1 from 'insert into t1 values(?,?),(?,?)';
execute stmt1 using @arg00, @arg01, @arg02, @arg03 ;
-select a,b from t1 where a in (@arg00,@arg02) order by a ;
+select a,b from t1 where a in (@arg00,@arg02) ;
a b
81 8-1
82 8-2
@@ -1489,6 +1501,7 @@ set @arg00=6 ;
set @arg01=1 ;
prepare stmt1 from 'insert into t1 set a=?, b=''sechs''
on duplicate key update a=a + ?, b=concat(b,''modified'') ';
+execute stmt1 using @arg00, @arg01;
select * from t1 order by a;
a b
0 NULL
@@ -1497,13 +1510,15 @@ a b
3 three
4 four
5 five
-6 six
+7 sixmodified
8 eight
9 nine
81 8-1
82 8-2
set @arg00=81 ;
set @arg01=1 ;
+execute stmt1 using @arg00, @arg01;
+ERROR 23000: Duplicate entry '82' for key 1
drop table if exists t2 ;
create table t2 (id int auto_increment primary key)
ENGINE= 'NDB' ;
@@ -1526,24 +1541,32 @@ set @x1100="x1100" ;
set @100=100 ;
set @updated="updated" ;
insert into t1 values(1000,'x1000_1') ;
+insert into t1 values(@1000,@x1000_2),(@1000,@x1000_3)
+on duplicate key update a = a + @100, b = concat(b,@updated) ;
select a,b from t1 where a >= 1000 order by a ;
a b
-1000 x1000_1
+1000 x1000_3
+1100 x1000_1updated
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
prepare stmt1 from ' insert into t1 values(?,?),(?,?)
on duplicate key update a = a + ?, b = concat(b,?) ';
+execute stmt1 using @1000, @x1000_2, @1000, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 order by a ;
a b
-1000 x1000_1
+1000 x1000_3
+1100 x1000_1updated
delete from t1 where a >= 1000 ;
insert into t1 values(1000,'x1000_1') ;
+execute stmt1 using @1000, @x1000_2, @1100, @x1000_3, @100, @updated ;
select a,b from t1 where a >= 1000 order by a ;
a b
-1000 x1000_1
+1200 x1000_1updatedupdated
delete from t1 where a >= 1000 ;
prepare stmt1 from ' replace into t1 (a,b) select 100, ''hundred'' ';
-ERROR HY000: This command is not supported in the prepared statement protocol yet
+execute stmt1;
+execute stmt1;
+execute stmt1;
test_sequence
------ multi table tests ------
delete from t1 ;
@@ -1648,6 +1671,9 @@ a b
1003 duplicate three
1004 duplicate four
delete from t1 where a >= 1000 ;
+set @1=1 ;
+set @2=2 ;
+set @100=100 ;
set @float=1.00;
set @five='five' ;
drop table if exists t2;
@@ -1750,10 +1776,10 @@ t5 CREATE TABLE `t5` (
`param10` bigint(20) default NULL,
`const11` int(4) default NULL,
`param11` bigint(20) default NULL,
- `const12` char(0) default NULL,
+ `const12` binary(0) default NULL,
`param12` bigint(20) default NULL,
`param13` double default NULL,
- `param14` longblob,
+ `param14` longtext,
`param15` longblob
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t5 ;
@@ -1780,10 +1806,10 @@ def test t5 t5 const10 const10 3 10 9 N 32769 0 63
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
-def test t5 t5 const12 const12 254 0 0 Y 0 0 8
+def test t5 t5 const12 const12 254 0 0 Y 128 0 63
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
def test t5 t5 param13 param13 5 20 0 Y 32768 31 63
-def test t5 t5 param14 param14 252 16777215 0 Y 144 0 63
+def test t5 t5 param14 param14 252 16777215 0 Y 16 0 8
def test t5 t5 param15 param15 252 16777215 0 Y 144 0 63
const01 8
param01 8
@@ -1892,16 +1918,16 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
-def @arg23 254 8192 8 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
-def @arg25 254 8192 4 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
-def @arg27 254 8192 10 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
-def @arg29 254 8192 8 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select @arg01:= c1, @arg02:= c2, @arg03:= c3, @arg04:= c4,
@@ -1936,19 +1962,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select
@@ -1989,16 +2015,16 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
-def @arg23 254 8192 8 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
-def @arg25 254 8192 4 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
-def @arg27 254 8192 10 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
-def @arg29 254 8192 8 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2026,19 +2052,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select ? := c1 from t9 where c1= 1" ;
@@ -2077,16 +2103,16 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
-def @arg23 254 8192 8 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
-def @arg25 254 8192 4 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
-def @arg27 254 8192 10 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
-def @arg29 254 8192 8 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2118,19 +2144,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12,
@@ -2167,16 +2193,16 @@ def @arg19 254 20 1 Y 128 31 63
def @arg20 254 8192 1 Y 0 31 8
def @arg21 254 8192 10 Y 0 31 8
def @arg22 254 8192 30 Y 0 31 8
-def @arg23 254 8192 8 Y 0 31 8
+def @arg23 254 8192 8 Y 128 31 63
def @arg24 254 8192 8 Y 0 31 8
-def @arg25 254 8192 4 Y 0 31 8
+def @arg25 254 8192 4 Y 128 31 63
def @arg26 254 8192 4 Y 0 31 8
-def @arg27 254 8192 10 Y 0 31 8
+def @arg27 254 8192 10 Y 128 31 63
def @arg28 254 8192 10 Y 0 31 8
-def @arg29 254 8192 8 Y 0 31 8
+def @arg29 254 8192 8 Y 128 31 63
def @arg30 254 8192 8 Y 0 31 8
def @arg31 254 8192 3 Y 0 31 8
-def @arg32 254 8192 6 Y 128 31 63
+def @arg32 254 8192 6 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
1 1 1 1 1 1 1 1 1 1 1 1 2004-02-29 2004-02-29 11:11:11 2004-02-29 11:11:11 11:11:11 2004 1 1 a 123456789a 123456789a123456789b123456789c tinyblob tinytext blob text mediumblob mediumtext longblob longtext one monday
set @my_key= 0 ;
@@ -2202,19 +2228,19 @@ def @arg16 254 8192 0 Y 128 31 63
def @arg17 254 20 0 Y 128 31 63
def @arg18 254 20 0 Y 128 31 63
def @arg19 254 20 0 Y 128 31 63
-def @arg20 254 8192 0 Y 128 31 63
-def @arg21 254 8192 0 Y 128 31 63
-def @arg22 254 8192 0 Y 128 31 63
+def @arg20 254 8192 0 Y 0 31 8
+def @arg21 254 8192 0 Y 0 31 8
+def @arg22 254 8192 0 Y 0 31 8
def @arg23 254 8192 0 Y 128 31 63
-def @arg24 254 8192 0 Y 128 31 63
+def @arg24 254 8192 0 Y 0 31 8
def @arg25 254 8192 0 Y 128 31 63
-def @arg26 254 8192 0 Y 128 31 63
+def @arg26 254 8192 0 Y 0 31 8
def @arg27 254 8192 0 Y 128 31 63
-def @arg28 254 8192 0 Y 128 31 63
+def @arg28 254 8192 0 Y 0 31 8
def @arg29 254 8192 0 Y 128 31 63
-def @arg30 254 8192 0 Y 128 31 63
-def @arg31 254 8192 0 Y 128 31 63
-def @arg32 254 8192 0 Y 128 31 63
+def @arg30 254 8192 0 Y 0 31 8
+def @arg31 254 8192 0 Y 0 31 8
+def @arg32 254 8192 0 Y 0 31 8
@arg01 @arg02 @arg03 @arg04 @arg05 @arg06 @arg07 @arg08 @arg09 @arg10 @arg11 @arg12 @arg13 @arg14 @arg15 @arg16 @arg17 @arg18 @arg19 @arg20 @arg21 @arg22 @arg23 @arg24 @arg25 @arg26 @arg27 @arg28 @arg29 @arg30 @arg31 @arg32
0 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 1991-01-01 01:01:01 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
prepare stmt1 from "select c1 into ? from t9 where c1= 1" ;
@@ -2771,14 +2797,14 @@ c1 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30
41 4 41 41 41 41 41 41 41 41 41 41
42 4 42 42 42 42 42 42 42 42 42 42
43 4 43 43 43 43 43 43 43 43 43 43
-50 5 50 50 50 50 50 50 50 50 50 50
+50 5 50 50 50.00 50.00 50.00 50.00 50.00 50.00 50.00 50.00
51 5 51 51 51 51 51 51 51 51 51 51
-52 5 52 52 52 52 52 52 52 52 52 52
-53 5 53 53 53 53 53 53 53 53 53 53
-54 5 54 54 54 54 54 54 54 54 54 54
+52 5 52 52 52.00 52.00 52.00 52.00 52.00 52.00 52.00 52.00
+53 5 53 53 53.00 53.00 53.00 53.00 53.00 53.00 53.00 53.00
+54 5 54 54 54.00 54.00 54.00 54.00 54.00 54.00 54.00 54.00
55 5 55 55 55 55 55 55 55 55 55 55
-56 6 56 56 56 56 56 56 56 56 56 56
-57 6 57 57 57 57 57 57 57 57 57 57
+56 6 56 56 56.00 56.00 56.00 56.00 56.00 56.00 56.00 56.00
+57 6 57 57 57.00 57.00 57.00 57.00 57.00 57.00 57.00 57.00
60 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
61 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
62 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
@@ -2984,7 +3010,7 @@ c1 c13 c14 c15 c16 c17
42 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
43 0000-00-00 0000-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
50 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
-51 0010-00-00 0010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
+51 2010-00-00 2010-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
52 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
53 2001-00-00 2001-00-00 00:00:00 0000-00-00 00:00:00 838:59:59 0000
60 NULL NULL 1991-01-01 01:01:01 NULL NULL
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index d68da39b19f..9f61b029391 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -791,6 +791,19 @@ Qcache_queries_in_cache 1
unlock table;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
+CREATE TABLE t1 (id INT PRIMARY KEY);
+insert into t1 values (1),(2),(3);
+select * from t1;
+id
+1
+2
+3
+create temporary table t1 (a int not null auto_increment
+primary key);
+select * from t1;
+a
+drop table t1;
+drop table t1;
SET NAMES koi8r;
CREATE TABLE t1 (a char(1) character set koi8r);
INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
diff --git a/mysql-test/r/query_cache.result.es b/mysql-test/r/query_cache.result.es
index 218e4e1ae2a..7e75a3cee4c 100644
--- a/mysql-test/r/query_cache.result.es
+++ b/mysql-test/r/query_cache.result.es
@@ -791,11 +791,24 @@ Qcache_queries_in_cache 1
unlock table;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
+CREATE TABLE t1 (id INT PRIMARY KEY);
+insert into t1 values (1),(2),(3);
+select * from t1;
+id
+1
+2
+3
+create temporary table t1 (a int not null auto_increment
+primary key);
+select * from t1;
+a
+drop table t1;
+drop table t1;
SET NAMES koi8r;
CREATE TABLE t1 (a char(1) character set koi8r);
INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
SELECT a,'Â','â'='Â' FROM t1;
-a б 'Б'='б'
+a  'â'='Â'
á Â 1
Á Â 1
show status like "Qcache_hits";
@@ -806,7 +819,7 @@ Variable_name Value
Qcache_queries_in_cache 1
set collation_connection=koi8r_bin;
SELECT a,'Â','â'='Â' FROM t1;
-a б 'Б'='б'
+a  'â'='Â'
á Â 0
Á Â 0
show status like "Qcache_hits";
@@ -817,7 +830,7 @@ Variable_name Value
Qcache_queries_in_cache 2
set character_set_client=cp1251;
SELECT a,'Â','â'='Â' FROM t1;
-a В 'в'='В'
+a ÷ '×'='÷'
á ÷ 0
Á ÷ 0
show status like "Qcache_hits";
@@ -828,7 +841,7 @@ Variable_name Value
Qcache_queries_in_cache 3
set character_set_results=cp1251;
SELECT a,'Â','â'='Â' FROM t1;
-a В 'в'='В'
+a  'â'='Â'
À Â 0
à Â 0
show status like "Qcache_hits";
@@ -901,6 +914,8 @@ set group_concat_max_len=10;
select group_concat(a) FROM t1 group by b;
group_concat(a)
1234567890
+Warnings:
+Warning 1260 1 line(s) were cut by GROUP_CONCAT()
set group_concat_max_len=1024;
select group_concat(a) FROM t1 group by b;
group_concat(a)
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 4ca96316800..fc2b4a78469 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -221,7 +221,7 @@ update t1 set y=x;
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 7 and t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
-1 SIMPLE t2 range x x 5 NULL 4 Using where
+1 SIMPLE t2 range x x 5 NULL 4 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 7 and t2.x <= t1.y+0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
@@ -237,7 +237,7 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t1, t1 t2 where t1.y = 2 and t2.x between 0 and t1.y;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
-1 SIMPLE t2 ALL x NULL NULL NULL 9 Using where
+1 SIMPLE t2 ALL x NULL NULL NULL 9 Range checked for each record (index map: 0x1)
explain select * from t1, t1 t2 where t1.y = 2 and t2.x >= 0 and t2.x <= t1.y;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref y y 5 const 1 Using where
@@ -561,3 +561,19 @@ select count(*) from t1 where x = 18446744073709551601;
count(*)
1
drop table t1;
+set names latin1;
+create table t1 (a char(10), b text, key (a)) character set latin1;
+INSERT INTO t1 (a) VALUES
+('111'),('222'),('222'),('222'),('222'),('444'),('aaa'),('AAA'),('bbb');
+explain select * from t1 where a='aaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref a a 11 const 2 Using where
+explain select * from t1 where a=binary 'aaa';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 2 Using where
+explain select * from t1 where a='aaa' collate latin1_bin;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a a 11 NULL 2 Using where
+explain select * from t1 where a='aaa' collate latin1_german1_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL a NULL NULL NULL 9 Using where
diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result
index 54cce23b301..292cfb19175 100644
--- a/mysql-test/r/rpl_charset.result
+++ b/mysql-test/r/rpl_charset.result
@@ -105,62 +105,62 @@ drop database mysqltest2;
drop database mysqltest3;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
-master-bin.000001 79 Query 1 79 use `test`; drop database if exists mysqltest2
-master-bin.000001 148 Query 1 148 use `test`; drop database if exists mysqltest3
-master-bin.000001 217 Query 1 217 use `test`; create database mysqltest2 character set latin2
-master-bin.000001 299 Query 1 299 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
-master-bin.000001 433 Query 1 433 use `test`; create database mysqltest3
-master-bin.000001 494 Query 1 494 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
-master-bin.000001 628 Query 1 628 use `test`; drop database mysqltest3
-master-bin.000001 687 Query 1 687 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
-master-bin.000001 821 Query 1 821 use `test`; create database mysqltest3
-master-bin.000001 882 Query 1 882 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 1022 Query 1 1022 use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
-master-bin.000001 1129 Query 1 1129 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 1270 Intvar 1 1270 INSERT_ID=1
-master-bin.000001 1298 Query 1 1298 use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
-master-bin.000001 1388 Query 1 1388 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 1529 Intvar 1 1529 INSERT_ID=2
-master-bin.000001 1557 Query 1 1557 use `mysqltest2`; insert into t1 (b) values(@@collation_server)
-master-bin.000001 1643 Query 1 1643 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 1784 Intvar 1 1784 INSERT_ID=3
-master-bin.000001 1812 Query 1 1812 use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
-master-bin.000001 1902 Query 1 1902 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 2043 Intvar 1 2043 INSERT_ID=4
-master-bin.000001 2071 Query 1 2071 use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
-master-bin.000001 2165 Query 1 2165 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 2306 Intvar 1 2306 INSERT_ID=5
-master-bin.000001 2334 Query 1 2334 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 2424 Query 1 2424 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 2564 Query 1 2564 use `mysqltest2`; truncate table t1
-master-bin.000001 2622 Query 1 2622 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 2762 Intvar 1 2762 INSERT_ID=1
-master-bin.000001 2790 Query 1 2790 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 2880 Query 1 2880 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 3020 Intvar 1 3020 INSERT_ID=2
-master-bin.000001 3048 Query 1 3048 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
-master-bin.000001 3141 Query 1 3141 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 3282 Intvar 1 3282 INSERT_ID=3
-master-bin.000001 3310 Query 1 3310 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
-master-bin.000001 3400 Query 1 3400 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 3541 Intvar 1 3541 INSERT_ID=4
-master-bin.000001 3569 Query 1 3569 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
-master-bin.000001 3662 Query 1 3662 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 3803 Intvar 1 3803 INSERT_ID=74
-master-bin.000001 3831 Create_file 1 3831 db=mysqltest2;table=t1;file_id=1;block_len=581
-master-bin.000001 4504 Query 1 4504 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 4645 Intvar 1 4645 INSERT_ID=5
-master-bin.000001 4673 Exec_load 1 4673 ;file_id=1
-master-bin.000001 4696 Query 1 4696 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 4837 Query 1 4837 use `mysqltest2`; truncate table t1
-master-bin.000001 4895 Query 1 4895 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 5036 Intvar 1 5036 INSERT_ID=1
-master-bin.000001 5064 User var 1 5064 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
-master-bin.000001 5104 Query 1 5104 use `mysqltest2`; insert into t1 (b) values(collation(@a))
-master-bin.000001 5185 Query 1 5185 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 5326 Query 1 5326 use `mysqltest2`; drop database mysqltest2
-master-bin.000001 5391 Query 1 5391 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
-master-bin.000001 5522 Query 1 5522 drop database mysqltest3
+master-bin.000001 79 Query 1 79 drop database if exists mysqltest2
+master-bin.000001 154 Query 1 154 drop database if exists mysqltest3
+master-bin.000001 229 Query 1 229 create database mysqltest2 character set latin2
+master-bin.000001 317 Query 1 317 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=30
+master-bin.000001 451 Query 1 451 create database mysqltest3
+master-bin.000001 518 Query 1 518 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
+master-bin.000001 652 Query 1 652 drop database mysqltest3
+master-bin.000001 717 Query 1 717 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=8,COLLATION_SERVER=64
+master-bin.000001 851 Query 1 851 create database mysqltest3
+master-bin.000001 918 Query 1 918 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=8,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1058 Query 1 1058 use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100))
+master-bin.000001 1165 Query 1 1165 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1306 Intvar 1 1306 INSERT_ID=1
+master-bin.000001 1334 Query 1 1334 use `mysqltest2`; insert into t1 (b) values(@@character_set_server)
+master-bin.000001 1424 Query 1 1424 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1565 Intvar 1 1565 INSERT_ID=2
+master-bin.000001 1593 Query 1 1593 use `mysqltest2`; insert into t1 (b) values(@@collation_server)
+master-bin.000001 1679 Query 1 1679 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 1820 Intvar 1 1820 INSERT_ID=3
+master-bin.000001 1848 Query 1 1848 use `mysqltest2`; insert into t1 (b) values(@@character_set_client)
+master-bin.000001 1938 Query 1 1938 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2079 Intvar 1 2079 INSERT_ID=4
+master-bin.000001 2107 Query 1 2107 use `mysqltest2`; insert into t1 (b) values(@@character_set_connection)
+master-bin.000001 2201 Query 1 2201 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=4,COLLATION_CONNECTION=27,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2342 Intvar 1 2342 INSERT_ID=5
+master-bin.000001 2370 Query 1 2370 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 2460 Query 1 2460 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2600 Query 1 2600 use `mysqltest2`; truncate table t1
+master-bin.000001 2658 Query 1 2658 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 2798 Intvar 1 2798 INSERT_ID=1
+master-bin.000001 2826 Query 1 2826 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 2916 Query 1 2916 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=5,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3056 Intvar 1 3056 INSERT_ID=2
+master-bin.000001 3084 Query 1 3084 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 3177 Query 1 3177 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3318 Intvar 1 3318 INSERT_ID=3
+master-bin.000001 3346 Query 1 3346 use `mysqltest2`; insert into t1 (b) values(@@collation_connection)
+master-bin.000001 3436 Query 1 3436 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3577 Intvar 1 3577 INSERT_ID=4
+master-bin.000001 3605 Query 1 3605 use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler"))
+master-bin.000001 3698 Query 1 3698 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 3839 Intvar 1 3839 INSERT_ID=74
+master-bin.000001 3867 Create_file 1 3867 db=mysqltest2;table=t1;file_id=1;block_len=581
+master-bin.000001 4540 Query 1 4540 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 4681 Intvar 1 4681 INSERT_ID=5
+master-bin.000001 4709 Exec_load 1 4709 ;file_id=1
+master-bin.000001 4732 Query 1 4732 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 4873 Query 1 4873 use `mysqltest2`; truncate table t1
+master-bin.000001 4931 Query 1 4931 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 5072 Intvar 1 5072 INSERT_ID=1
+master-bin.000001 5100 User var 1 5100 @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci
+master-bin.000001 5140 Query 1 5140 use `mysqltest2`; insert into t1 (b) values(collation(@a))
+master-bin.000001 5221 Query 1 5221 use `mysqltest2`; SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 5362 Query 1 5362 drop database mysqltest2
+master-bin.000001 5427 Query 1 5427 SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
+master-bin.000001 5558 Query 1 5558 drop database mysqltest3
set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation
set global character_set_server=latin2;
@@ -200,10 +200,17 @@ hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
stop slave;
delete from t1;
-change master to master_log_pos=5801;
-start slave until master_log_file='master-bin.000001', master_log_pos=5937;
+change master to master_log_pos=5847;
+start slave until master_log_file='master-bin.000001', master_log_pos=5983;
start slave;
select hex(c1), hex(c2) from t1;
hex(c1) hex(c2)
CDF32C20E7E020F0FBE1E0EBEAF3 CDF32C20E7E020F0FBE1E0EBEAF3
drop table t1;
+create table `t1` (
+`pk` varchar(10) not null default '',
+primary key (`pk`)
+) engine=myisam default charset=latin1;
+set @p=_latin1 'test';
+update t1 set pk='test' where pk=@p;
+drop table t1;
diff --git a/mysql-test/r/rpl_create_database.result b/mysql-test/r/rpl_create_database.result
new file mode 100644
index 00000000000..2375e13bb5c
--- /dev/null
+++ b/mysql-test/r/rpl_create_database.result
@@ -0,0 +1,83 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
+DROP DATABASE IF EXISTS mysqltest_bob;
+CREATE DATABASE mysqltest_prometheus;
+CREATE DATABASE mysqltest_sisyfos;
+CREATE DATABASE mysqltest_bob;
+USE mysqltest_sisyfos;
+CREATE TABLE t1 (b int);
+INSERT INTO t1 VALUES(1);
+USE mysqltest_bob;
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES(2);
+ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1;
+USE mysqltest_sisyfos;
+ALTER DATABASE mysqltest_bob CHARACTER SET latin1;
+SHOW DATABASES;
+Database
+mysql
+mysqltest_bob
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW DATABASES;
+Database
+mysql
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+USE mysqltest_prometheus;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+CREATE DATABASE mysqltest_sisyfos;
+USE mysqltest_sisyfos;
+CREATE TABLE t2 (a INT);
+SHOW BINLOG EVENTS;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+master-bin.000001 79 Query 1 79 DROP DATABASE IF EXISTS mysqltest_prometheus
+master-bin.000001 174 Query 1 174 DROP DATABASE IF EXISTS mysqltest_sisyfos
+master-bin.000001 263 Query 1 263 CREATE DATABASE mysqltest_prometheus
+master-bin.000001 350 Query 1 350 CREATE DATABASE mysqltest_sisyfos
+master-bin.000001 431 Query 1 431 use `mysqltest_sisyfos`; CREATE TABLE t1 (b int)
+master-bin.000001 502 Query 1 502 use `mysqltest_sisyfos`; INSERT INTO t1 VALUES(1)
+master-bin.000001 574 Query 1 574 ALTER DATABASE mysqltest_sisyfos CHARACTER SET latin1
+master-bin.000001 675 Query 1 675 DROP DATABASE IF EXISTS mysqltest_sisyfos
+master-bin.000001 764 Query 1 764 use `mysqltest_prometheus`; CREATE TABLE t1 (a INT)
+master-bin.000001 838 Query 1 838 use `mysqltest_prometheus`; INSERT INTO t1 VALUES (1)
+master-bin.000001 914 Query 1 914 CREATE DATABASE mysqltest_sisyfos
+master-bin.000001 995 Query 1 995 use `mysqltest_sisyfos`; CREATE TABLE t2 (a INT)
+SHOW DATABASES;
+Database
+mysql
+mysqltest_bob
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW DATABASES;
+Database
+mysql
+mysqltest_prometheus
+mysqltest_sisyfos
+test
+SHOW CREATE TABLE mysqltest_prometheus.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SHOW CREATE TABLE mysqltest_sisyfos.t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP DATABASE IF EXISTS mysqltest_prometheus;
+DROP DATABASE IF EXISTS mysqltest_sisyfos;
+DROP DATABASE IF EXISTS mysqltest_bob;
diff --git a/mysql-test/r/rpl_drop_temp.result b/mysql-test/r/rpl_drop_temp.result
new file mode 100644
index 00000000000..e00309cac8f
--- /dev/null
+++ b/mysql-test/r/rpl_drop_temp.result
@@ -0,0 +1,12 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create database if not exists mysqltest;
+create temporary table mysqltest.t1 (n int);
+create temporary table mysqltest.t2 (n int);
+show status like 'Slave_open_temp_tables';
+Variable_name Value
+Slave_open_temp_tables 0
diff --git a/mysql-test/r/rpl_failed_optimize.result b/mysql-test/r/rpl_failed_optimize.result
new file mode 100644
index 00000000000..1576ec60500
--- /dev/null
+++ b/mysql-test/r/rpl_failed_optimize.result
@@ -0,0 +1,15 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 ( a int ) ENGINE=InnoDB;
+BEGIN;
+INSERT INTO t1 VALUES (1);
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status Operation failed
+OPTIMIZE TABLE non_existing;
+Table Op Msg_type Msg_text
+test.non_existing optimize error Table 'test.non_existing' doesn't exist
diff --git a/mysql-test/r/rpl_insert_id.result b/mysql-test/r/rpl_insert_id.result
index 8001cb59a35..8482f631553 100644
--- a/mysql-test/r/rpl_insert_id.result
+++ b/mysql-test/r/rpl_insert_id.result
@@ -68,3 +68,8 @@ b c
9 13
drop table t1;
drop table t2;
+SET TIMESTAMP=1000000000;
+CREATE TABLE t1 ( a INT UNIQUE );
+SET FOREIGN_KEY_CHECKS=0;
+INSERT INTO t1 VALUES (1),(1);
+ERROR 23000: Duplicate entry '1' for key 1
diff --git a/mysql-test/r/rpl_insert_ignore.result b/mysql-test/r/rpl_insert_ignore.result
new file mode 100644
index 00000000000..da24c86627c
--- /dev/null
+++ b/mysql-test/r/rpl_insert_ignore.result
@@ -0,0 +1,70 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=innodb;
+CREATE TABLE t2 (
+a int unsigned, # to force INSERT SELECT to have a certain order
+b int unsigned
+) ENGINE=innodb;
+INSERT INTO t1 VALUES (NULL, 1);
+INSERT INTO t1 VALUES (NULL, 2);
+INSERT INTO t1 VALUES (NULL, 3);
+INSERT INTO t1 VALUES (NULL, 4);
+INSERT INTO t2 VALUES (1, 1);
+INSERT INTO t2 VALUES (2, 2);
+INSERT INTO t2 VALUES (3, 5);
+INSERT INTO t2 VALUES (4, 3);
+INSERT INTO t2 VALUES (5, 4);
+INSERT INTO t2 VALUES (6, 6);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned,
+unique (b)
+) ENGINE=myisam;
+INSERT INTO t1 VALUES (1, 1);
+INSERT INTO t1 VALUES (2, 2);
+INSERT INTO t1 VALUES (3, 3);
+INSERT INTO t1 VALUES (4, 4);
+INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+SELECT * FROM t1 ORDER BY a;
+a b
+1 1
+2 2
+3 3
+4 4
+5 5
+6 6
+drop table t1, t2;
diff --git a/mysql-test/r/rpl_loaddata_rule_m.result b/mysql-test/r/rpl_loaddata_rule_m.result
index a34453b0a2b..08f2c2ec071 100644
--- a/mysql-test/r/rpl_loaddata_rule_m.result
+++ b/mysql-test/r/rpl_loaddata_rule_m.result
@@ -12,4 +12,6 @@ use mysqltest;
load data infile '../../std_data/rpl_loaddata.dat' into table test.t1;
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 79 Query 1 79 drop database if exists mysqltest
+master-bin.000001 152 Query 1 152 create database mysqltest
drop database mysqltest;
diff --git a/mysql-test/r/rpl_many_optimize.result b/mysql-test/r/rpl_many_optimize.result
new file mode 100644
index 00000000000..b2148892591
--- /dev/null
+++ b/mysql-test/r/rpl_many_optimize.result
@@ -0,0 +1,9 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+create table t1 (a int not null auto_increment primary key, b int, key(b));
+INSERT INTO t1 (a) VALUES (1),(2);
+drop table t1;
diff --git a/mysql-test/r/rpl_multi_query.result b/mysql-test/r/rpl_multi_query.result
new file mode 100644
index 00000000000..2521dbe1ed9
--- /dev/null
+++ b/mysql-test/r/rpl_multi_query.result
@@ -0,0 +1,32 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest;
+create database mysqltest;
+create table mysqltest.t1 ( n int);
+insert into mysqltest.t1 values(1)/
+insert into mysqltest.t1 values(2);
+insert into mysqltest.t1 values(3);
+insert into mysqltest.t1 values(4);
+insert into mysqltest.t1 values(5)/
+select * from mysqltest.t1;
+n
+1
+2
+3
+4
+5
+show binlog events from 79;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.000001 # Query 1 # drop database if exists mysqltest
+master-bin.000001 # Query 1 # create database mysqltest
+master-bin.000001 # Query 1 # use `test`; create table mysqltest.t1 ( n int)
+master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(1)
+master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(2)
+master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(3)
+master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(4)
+master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(5)
+drop database mysqltest;
diff --git a/mysql-test/r/rpl_multi_update2.result b/mysql-test/r/rpl_multi_update2.result
new file mode 100644
index 00000000000..99356ebf970
--- /dev/null
+++ b/mysql-test/r/rpl_multi_update2.result
@@ -0,0 +1,42 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+CREATE TABLE t1 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+CREATE TABLE t2 (
+a int unsigned not null auto_increment primary key,
+b int unsigned
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL, 0);
+INSERT INTO t1 SELECT NULL, 0 FROM t1;
+INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
+SELECT * FROM t1 ORDER BY a;
+a b
+1 0
+2 0
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+UPDATE t1, t2 SET t1.b = (t2.b+4) WHERE t1.a = t2.a;
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
+SELECT * FROM t1 ORDER BY a;
+a b
+1 4
+2 5
+SELECT * FROM t2 ORDER BY a;
+a b
+1 0
+2 1
diff --git a/mysql-test/r/rpl_rewrite_db.result b/mysql-test/r/rpl_rewrite_db.result
new file mode 100644
index 00000000000..a2c8706e3e1
--- /dev/null
+++ b/mysql-test/r/rpl_rewrite_db.result
@@ -0,0 +1,92 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+drop database if exists mysqltest1;
+create database mysqltest1;
+use mysqltest1;
+create table t1 (a int);
+insert into t1 values(9);
+select * from mysqltest1.t1;
+a
+9
+show databases like 'mysqltest1';
+Database (mysqltest1)
+mysqltest1
+select * from test.t1;
+a
+9
+drop table t1;
+drop database mysqltest1;
+drop database if exists rewrite;
+create database rewrite;
+use test;
+create table t1 (a date, b date, c date not null, d date);
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',';
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 1
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'a' at row 2
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES;
+select * from rewrite.t1;
+a b c d
+0000-00-00 NULL 0000-00-00 0000-00-00
+0000-00-00 0000-00-00 0000-00-00 0000-00-00
+2003-03-03 2003-03-03 2003-03-03 NULL
+2003-03-03 2003-03-03 2003-03-03 NULL
+truncate table t1;
+load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d);
+Warnings:
+Warning 1265 Data truncated for column 'c' at row 1
+Warning 1265 Data truncated for column 'd' at row 1
+Warning 1265 Data truncated for column 'b' at row 2
+Warning 1265 Data truncated for column 'd' at row 2
+select * from rewrite.t1;
+a b c d
+NULL NULL 0000-00-00 0000-00-00
+NULL 0000-00-00 0000-00-00 0000-00-00
+NULL 2003-03-03 2003-03-03 NULL
+drop table t1;
+create table t1 (a text, b text);
+load data infile '../../std_data/loaddata2.dat' into table t1 fields terminated by ',' enclosed by '''';
+Warnings:
+Warning 1261 Row 3 doesn't contain data for all columns
+select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
+concat('|',a,'|') concat('|',b,'|')
+|Field A| |Field B|
+|Field 1| |Field 2'
+Field 3,'Field 4|
+|Field 5' ,'Field 6| NULL
+|Field 6| | 'Field 7'|
+drop table t1;
+create table t1 (a int, b char(10));
+load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+Warning 1262 Row 3 was truncated; it contained more data than there were input columns
+Warning 1265 Data truncated for column 'a' at row 5
+Warning 1262 Row 5 was truncated; it contained more data than there were input columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+0 1234567890
+3 row 3
+0 1234567890
+truncate table t1;
+load data infile '../../std_data/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 4
+Warning 1261 Row 4 doesn't contain data for all columns
+select * from rewrite.t1;
+a b
+1 row 1
+2 row 2
+3 row 3
+0
+drop table t1;
diff --git a/mysql-test/r/rpl_start_stop_slave.result b/mysql-test/r/rpl_start_stop_slave.result
new file mode 100644
index 00000000000..1fcb586d1fb
--- /dev/null
+++ b/mysql-test/r/rpl_start_stop_slave.result
@@ -0,0 +1,12 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+stop slave;
+create table t1(n int);
+start slave;
+stop slave io_thread;
+start slave io_thread;
+drop table t1;
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index ba0a80331b1..1a3b2ab22e6 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -2057,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
+do default;
+ERROR 42000: 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 '' at line 1
+do foobar;
+ERROR 42S22: Unknown column 'foobar' in 'field list'
CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '',
@@ -2349,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s;
s s
two two
drop table t1, t2, t3;
+create table t1 (a integer, b integer, index(a), index(b));
+create table t2 (c integer, d integer, index(c), index(d));
+insert into t1 values (1,2), (2,2), (3,2), (4,2);
+insert into t2 values (1,3), (2,3), (3,4), (4,4);
+explain select * from t1 left join t2 on a=c where d in (4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+select * from t1 left join t2 on a=c where d in (4);
+a b c d
+3 2 3 4
+4 2 4 4
+explain select * from t1 left join t2 on a=c where d = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+select * from t1 left join t2 on a=c where d = 4;
+a b c d
+3 2 3 4
+4 2 4 4
+drop table t1, t2;
CREATE TABLE t1 (
i int(11) NOT NULL default '0',
c char(10) NOT NULL default '',
@@ -2361,7 +2386,39 @@ INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
-EXPLAIN SELECT i FROM t1 WHERE i=1;
+DROP TABLE t1;
+CREATE TABLE t1 ( a BLOB, INDEX (a(20)) );
+CREATE TABLE t2 ( a BLOB, INDEX (a(20)) );
+INSERT INTO t1 VALUES ('one'),('two'),('three'),('four'),('five');
+INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+1 SIMPLE t2 ref a a 23 test.t1.a 2
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 5
+1 SIMPLE t2 ref a a 23 test.t1.a 2
+DROP TABLE t1, t2;
+CREATE TABLE t1 ( city char(30) );
+INSERT INTO t1 VALUES ('London');
+INSERT INTO t1 VALUES ('Paris');
+SELECT * FROM t1 WHERE city='London';
+city
+London
+SELECT * FROM t1 WHERE city='london';
+city
+London
+EXPLAIN SELECT * FROM t1 WHERE city='London' AND city='london';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT * FROM t1 WHERE city='London' AND city='london';
+city
+London
+EXPLAIN SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
+SELECT * FROM t1 WHERE city LIKE '%london%' AND city='London';
+city
+London
DROP TABLE t1;
diff --git a/mysql-test/r/select.result.es b/mysql-test/r/select.result.es
index 2ff58372d6d..da761ebb822 100644
--- a/mysql-test/r/select.result.es
+++ b/mysql-test/r/select.result.es
@@ -1,4 +1,5 @@
drop table if exists t1,t2,t3,t4;
+drop table if exists t1_1,t1_2,t9_1,t9_2;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
@@ -2056,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
+do default;
+ERROR 42000: 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 '' at line 1
+do foobar;
+ERROR 42S22: Unknown column 'foobar' in 'field list'
CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '',
@@ -2348,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s;
s s
two two
drop table t1, t2, t3;
+create table t1 (a integer, b integer, index(a), index(b));
+create table t2 (c integer, d integer, index(c), index(d));
+insert into t1 values (1,2), (2,2), (3,2), (4,2);
+insert into t2 values (1,3), (2,3), (3,4), (4,4);
+explain select * from t1 left join t2 on a=c where d in (4);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+select * from t1 left join t2 on a=c where d in (4);
+a b c d
+3 2 3 4
+4 2 4 4
+explain select * from t1 left join t2 on a=c where d = 4;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 ref c,d d 5 const 2 Using where
+1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
+select * from t1 left join t2 on a=c where d = 4;
+a b c d
+3 2 3 4
+4 2 4 4
+drop table t1, t2;
CREATE TABLE t1 (
i int(11) NOT NULL default '0',
c char(10) NOT NULL default '',
@@ -2360,7 +2386,4 @@ INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
-EXPLAIN SELECT i FROM t1 WHERE i=1;
-id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1;
diff --git a/mysql-test/r/select_found.result b/mysql-test/r/select_found.result
index 1eaa7033c99..b8178bbeb52 100644
--- a/mysql-test/r/select_found.result
+++ b/mysql-test/r/select_found.result
@@ -271,3 +271,12 @@ foo
SELECT FOUND_ROWS();
FOUND_ROWS()
2
+CREATE TABLE t1 (a int, b int);
+INSERT INTO t1 VALUES (1,2), (1,3), (1,4), (1,5);
+SELECT SQL_CALC_FOUND_ROWS DISTINCT 'a' FROM t1 GROUP BY b LIMIT 2;
+a
+a
+SELECT FOUND_ROWS();
+FOUND_ROWS()
+1
+DROP TABLE t1;
diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result
index 8256c8d692a..37531f05f43 100644
--- a/mysql-test/r/show_check.result
+++ b/mysql-test/r/show_check.result
@@ -314,57 +314,57 @@ insert into t2 values (1),(2);
insert into t3 values (1,1),(2,2);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 2 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 2 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
insert into t1 values (3),(4);
insert into t2 values (3),(4);
insert into t3 values (3,3),(4,4);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 4 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 4 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 5 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 5 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
delete from t1 where a=3;
delete from t2 where b=3;
delete from t3 where a=3;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 4 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 4 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
delete from t1;
delete from t2;
delete from t3;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 0 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 0 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
insert into t1 values (5);
insert into t2 values (5);
insert into t3 values (5,5);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 1 5 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 1 9 # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
delete from t1 where a=5;
delete from t2 where b=5;
delete from t3 where a=5;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 HEAP 9 Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
-t2 HEAP 9 Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL
-t3 HEAP 9 Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
+t1 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t2 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
+t3 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
drop table t1, t2, t3;
create database mysqltest;
show create database mysqltest;
@@ -405,3 +405,73 @@ where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
delete from mysql.db
where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3';
flush privileges;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING HASH (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE HASH (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
+CREATE TABLE t1 (i int, KEY USING BTREE (i)) ENGINE=MyISAM;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ALTER TABLE t1 ENGINE=MEMORY;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL,
+ KEY `i` TYPE BTREE (`i`)
+) ENGINE=HEAP DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/r/skip_name_resolve.result b/mysql-test/r/skip_name_resolve.result
new file mode 100644
index 00000000000..d8d873699a5
--- /dev/null
+++ b/mysql-test/r/skip_name_resolve.result
@@ -0,0 +1,7 @@
+GRANT ALL ON test.* TO mysqltest_1@'127.0.0.1/255.255.255.255';
+SHOW GRANTS FOR mysqltest_1@'127.0.0.1/255.255.255.255';
+Grants for mysqltest_1@127.0.0.1/255.255.255.255
+GRANT USAGE ON *.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
+GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'127.0.0.1/255.255.255.255'
+REVOKE ALL ON test.* FROM mysqltest_1@'127.0.0.1/255.255.255.255';
+DROP USER mysqltest_1@'127.0.0.1/255.255.255.255';
diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result
index e54dd217f8c..c18be2df403 100644
--- a/mysql-test/r/sql_mode.result
+++ b/mysql-test/r/sql_mode.result
@@ -85,6 +85,36 @@ t1 CREATE TABLE "t1" (
UNIQUE KEY "email" ("email")
)
drop table t1;
+CREATE TABLE t1 (
+a char(10),
+b char(10) collate latin1_bin,
+c binary(10)
+) character set latin1;
+set @@sql_mode="";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) character set latin1 collate latin1_bin default NULL,
+ `c` binary(10) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+set @@sql_mode="mysql323";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) binary default NULL,
+ `c` binary(10) default NULL
+) TYPE=MyISAM
+set @@sql_mode="mysql40";
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(10) default NULL,
+ `b` char(10) binary default NULL,
+ `c` binary(10) default NULL
+) TYPE=MyISAM
+drop table t1;
set session sql_mode = '';
create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 04c5f685f58..fb42f68398f 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -55,7 +55,7 @@ SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
1
1
SELECT (SELECT 1), a;
-ERROR 42S22: Unknown column 'a' in 'checking transformed subquery'
+ERROR 42S22: Unknown column 'a' in 'field list'
SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1;
a
1
@@ -269,7 +269,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
2 SUBQUERY t2 ALL NULL NULL NULL NULL 3
Warnings:
-Note 1003 select test.t3.a AS `a` from test.t3 where (test.t3.a >= (select min(test.t2.b) from test.t2))
+Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2)))
select * from t3 where a >= all (select b from t2);
a
7
@@ -999,7 +999,9 @@ drop table t1, t2;
CREATE TABLE `t1` (`i` int(11) NOT NULL default '0',PRIMARY KEY (`i`)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
-ERROR HY000: Invalid use of group function
+select * from t1;
+i
+1
drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
@@ -1084,7 +1086,7 @@ SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) NOT NULL default '0',
- `(SELECT a)` bigint(20) default NULL
+ `(SELECT a)` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
@@ -1102,7 +1104,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` bigint(20) default NULL
+ `a` bigint(20) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);
@@ -1186,11 +1188,12 @@ PRIMARY KEY (`i`)
) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i));
-ERROR HY000: Invalid use of group function
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
-ERROR HY000: Invalid use of group function
UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S02: Unknown table 't' in field list
+select * from t1;
+i
+1
drop table t1;
CREATE TABLE t1 (
id int(11) default NULL
@@ -1485,6 +1488,65 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
Warnings:
Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < (select max(test.t2.b) from test.t2)))
+select * from t3 where a >= some (select b from t2);
+a
+explain extended select * from t3 where a >= some (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= (select min(test.t2.b) from test.t2)))
+select * from t3 where a >= all (select b from t2 group by 1);
+a
+6
+7
+3
+explain extended select * from t3 where a >= all (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <not>((test.t3.a < <max>(select test.t2.b AS `b` from test.t2 group by test.t2.b)))
+select * from t3 where a >= some (select b from t2 group by 1);
+a
+explain extended select * from t3 where a >= some (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t3 ALL NULL NULL NULL NULL 3 Using where
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3 where <nop>((test.t3.a >= <min>(select test.t2.b AS `b` from test.t2 group by test.t2.b)))
+select * from t3 where NULL >= any (select b from t2);
+a
+explain extended select * from t3 where NULL >= any (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+select * from t3 where NULL >= any (select b from t2 group by 1);
+a
+explain extended select * from t3 where NULL >= any (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+select * from t3 where NULL >= some (select b from t2);
+a
+explain extended select * from t3 where NULL >= some (select b from t2);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
+select * from t3 where NULL >= some (select b from t2 group by 1);
+a
+explain extended select * from t3 where NULL >= some (select b from t2 group by 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY t2 system NULL NULL NULL NULL 0 const row not found
+Warnings:
+Note 1003 select test.t3.a AS `a` from test.t3
insert into t2 values (2,2), (2,1), (3,3), (3,1);
select * from t3 where a > all (select max(b) from t2 group by a);
a
@@ -1987,3 +2049,222 @@ ac
700
NULL
drop tables t1,t2;
+create table t1 (a int not null, b int not null, c int, primary key (a,b));
+insert into t1 values (1,1,1), (2,2,2), (3,3,3);
+set @b:= 0;
+explain select sum(a) from t1 where b > @b;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index NULL PRIMARY 8 NULL 3 Using where; Using index
+set @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+do @a:= (select sum(a) from t1 where b > @b);
+explain select a from t1 where c=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
+drop table t1;
+set @got_val= (SELECT 1 FROM (SELECT 'A' as my_col) as T1 ) ;
+create table t1 (a int, b int);
+create table t2 (a int, b int);
+insert into t1 values (1,1),(1,2),(1,3),(2,4),(2,5);
+insert into t2 values (1,3),(2,1);
+select distinct a,b, (select max(b) from t2 where t1.b=t2.a) from t1 order by t1.b;
+a b (select max(b) from t2 where t1.b=t2.a)
+1 1 3
+1 2 1
+1 3 NULL
+2 4 NULL
+2 5 NULL
+drop table t1, t2;
+create table t1 (id int);
+create table t2 (id int, body text, fulltext (body));
+insert into t1 values(1),(2),(3);
+insert into t2 values (1,'test'), (2,'mysql'), (3,'test'), (4,'test');
+select count(distinct id) from t1 where id in (select id from t2 where match(body) against ('mysql' in boolean mode));
+count(distinct id)
+1
+drop table t2,t1;
+create table t1 (s1 int,s2 int);
+insert into t1 values (20,15);
+select * from t1 where (('a',null) <=> (select 'a',s2 from t1 where s1 = 0));
+s1 s2
+drop table t1;
+create table t1 (s1 int);
+insert into t1 values (1),(null);
+select * from t1 where s1 < all (select s1 from t1);
+s1
+select s1, s1 < all (select s1 from t1) from t1;
+s1 s1 < all (select s1 from t1)
+1 0
+NULL NULL
+drop table t1;
+CREATE TABLE t1 (
+Code char(3) NOT NULL default '',
+Name char(52) NOT NULL default '',
+Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
+Region char(26) NOT NULL default '',
+SurfaceArea float(10,2) NOT NULL default '0.00',
+IndepYear smallint(6) default NULL,
+Population int(11) NOT NULL default '0',
+LifeExpectancy float(3,1) default NULL,
+GNP float(10,2) default NULL,
+GNPOld float(10,2) default NULL,
+LocalName char(45) NOT NULL default '',
+GovernmentForm char(45) NOT NULL default '',
+HeadOfState char(60) default NULL,
+Capital int(11) default NULL,
+Code2 char(2) NOT NULL default ''
+) ENGINE=MyISAM;
+INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
+INSERT INTO t1 VALUES ('ASM','American Samoa','Oceania','Polynesia',199.00,0,68000,75.1,334.00,NULL,'Amerika Samoa','US Territory','George W. Bush',54,'AS');
+INSERT INTO t1 VALUES ('ATF','French Southern territories','Antarctica','Antarctica',7780.00,0,0,NULL,0.00,NULL,'Terres australes françaises','Nonmetropolitan Territory of France','Jacques Chirac',NULL,'TF');
+INSERT INTO t1 VALUES ('UMI','United States Minor Outlying Islands','Oceania','Micronesia/Caribbean',16.00,0,0,NULL,0.00,NULL,'United States Minor Outlying Islands','Dependent Territory of the US','George W. Bush',NULL,'UM');
+/*!40000 ALTER TABLE t1 ENABLE KEYS */;
+SELECT DISTINCT Continent AS c FROM t1 WHERE Code <> SOME ( SELECT Code FROM t1 WHERE Continent = c AND Population < 200);
+c
+Oceania
+drop table t1;
+create table t1 (a1 int);
+create table t2 (b1 int);
+select * from t1 where a2 > any(select b1 from t2);
+ERROR 42S22: Unknown column 'a2' in 'scalar IN/ALL/ANY subquery'
+select * from t1 where a1 > any(select b1 from t2);
+a1
+drop table t1,t2;
+create table t1 (a integer, b integer);
+select (select * from t1) = (select 1,2);
+(select * from t1) = (select 1,2)
+NULL
+select (select 1,2) = (select * from t1);
+(select 1,2) = (select * from t1)
+NULL
+select row(1,2) = ANY (select * from t1);
+row(1,2) = ANY (select * from t1)
+0
+select row(1,2) != ALL (select * from t1);
+row(1,2) != ALL (select * from t1)
+1
+drop table t1;
+create table t1 (a integer, b integer);
+select row(1,(2,2)) in (select * from t1 );
+ERROR 21000: Operand should contain 2 column(s)
+select row(1,(2,2)) = (select * from t1 );
+ERROR 21000: Operand should contain 2 column(s)
+select (select * from t1) = row(1,(2,2));
+ERROR 21000: Operand should contain 1 column(s)
+drop table t1;
+create table t1 (a integer);
+insert into t1 values (1);
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
+xx 1 = ALL ( select 1 from t1 where 1 = xx )
+1 1
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
+ERROR 42S22: Reference 'xx' not supported (forward reference in item list)
+drop table t1;
+CREATE TABLE t1 (
+categoryId int(11) NOT NULL,
+courseId int(11) NOT NULL,
+startDate datetime NOT NULL,
+endDate datetime NOT NULL,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL,
+attributes text NOT NULL
+);
+INSERT INTO t1 VALUES (1,41,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
+(1,86,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(1,87,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(2,52,'2004-03-15','2004-10-01','2004-03-15','2004-09-17',''),
+(2,53,'2004-03-16','2004-10-01','2004-03-16','2004-09-17',''),
+(2,88,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(2,89,'2004-08-16','2004-08-16','2004-08-16','2004-08-16',''),
+(3,51,'2004-02-09','2010-01-01','2004-02-09','2004-02-09',''),
+(5,12,'2004-02-18','2010-01-01','2004-02-18','2004-02-18','');
+CREATE TABLE t2 (
+userId int(11) NOT NULL,
+courseId int(11) NOT NULL,
+date datetime NOT NULL
+);
+INSERT INTO t2 VALUES (5141,71,'2003-11-18'),
+(5141,72,'2003-11-25'),(5141,41,'2004-08-06'),
+(5141,52,'2004-08-06'),(5141,53,'2004-08-06'),
+(5141,12,'2004-08-06'),(5141,86,'2004-10-21'),
+(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
+(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
+CREATE TABLE t3 (
+groupId int(11) NOT NULL,
+parentId int(11) NOT NULL,
+startDate datetime NOT NULL,
+endDate datetime NOT NULL,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL,
+ordering int(11)
+);
+INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
+CREATE TABLE t4 (
+id int(11) NOT NULL,
+groupTypeId int(11) NOT NULL,
+groupKey varchar(50) NOT NULL,
+name text,
+ordering int(11),
+description text,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL
+);
+INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
+(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
+CREATE TABLE t5 (
+userId int(11) NOT NULL,
+groupId int(11) NOT NULL,
+createDate datetime NOT NULL,
+modifyDate timestamp NOT NULL
+);
+INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
+select
+count(distinct t2.userid) pass,
+groupstuff.*,
+count(t2.courseid) crse,
+t1.categoryid,
+t2.courseid,
+date_format(date, '%b%y') as colhead
+from t2
+join t1 on t2.courseid=t1.courseid
+join
+(
+select
+t5.userid,
+parentid,
+parentgroup,
+childid,
+groupname,
+grouptypeid
+from t5
+join
+(
+select t4.id as parentid,
+t4.name as parentgroup,
+t4.id as childid,
+t4.name as groupname,
+t4.grouptypeid
+from t4
+) as gin on t5.groupid=gin.childid
+) as groupstuff on t2.userid = groupstuff.userid
+group by
+groupstuff.groupname, colhead , t2.courseid;
+pass userid parentid parentgroup childid groupname grouptypeid crse categoryid courseid colhead
+1 5141 12 group2 12 group2 5 1 5 12 Aug04
+1 5141 12 group2 12 group2 5 1 1 41 Aug04
+1 5141 12 group2 12 group2 5 1 2 52 Aug04
+1 5141 12 group2 12 group2 5 1 2 53 Aug04
+1 5141 12 group2 12 group2 5 1 3 51 Oct04
+1 5141 12 group2 12 group2 5 1 1 86 Oct04
+1 5141 12 group2 12 group2 5 1 1 87 Oct04
+1 5141 12 group2 12 group2 5 1 2 88 Oct04
+1 5141 12 group2 12 group2 5 1 2 89 Oct04
+drop table if exists t1, t2, t3, t4, t5;
diff --git a/mysql-test/r/subselect_innodb.result b/mysql-test/r/subselect_innodb.result
index e8f6426f51b..0666fd76661 100644
--- a/mysql-test/r/subselect_innodb.result
+++ b/mysql-test/r/subselect_innodb.result
@@ -114,3 +114,41 @@ SELECT R.unit, R.ingredient FROM t1 R WHERE R.ingredient IN (SELECT N.ingredient
unit ingredient
xx yy
drop table t1, t2;
+CREATE TABLE t1 (
+id INT NOT NULL auto_increment,
+date1 DATE, coworkerid INT,
+description VARCHAR(255),
+sum_used DOUBLE,
+sum_remaining DOUBLE,
+comments VARCHAR(255),
+PRIMARY KEY(id)
+) engine=innodb;
+insert into t1 values (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1999-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '1998-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment'), (NULL, '2004-01-01', 1,'test', 22, 33, 'comment');
+SELECT DISTINCT
+(SELECT sum(sum_used) FROM t1 WHERE sum_used > 0 AND year(date1) <= '2004') as somallontvangsten,
+(SELECT sum(sum_used) FROM t1 WHERE sum_used < 0 AND year(date1) <= '2004') as somalluitgaven
+FROM t1;
+somallontvangsten somalluitgaven
+154 NULL
+select * from t1;
+id date1 coworkerid description sum_used sum_remaining comments
+1 1999-01-01 1 test 22 33 comment
+2 1999-01-01 1 test 22 33 comment
+3 1999-01-01 1 test 22 33 comment
+4 1998-01-01 1 test 22 33 comment
+5 1998-01-01 1 test 22 33 comment
+6 2004-01-01 1 test 22 33 comment
+7 2004-01-01 1 test 22 33 comment
+drop table t1;
+CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t2 VALUES (1,1,1);
+PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
+count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
+EXECUTE my_stmt;
+b count(*)
+EXECUTE my_stmt;
+b count(*)
+deallocate prepare my_stmt;
+drop table t1,t2;
diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result
index ebb24159373..141878a7bf6 100644
--- a/mysql-test/r/system_mysql_db.result
+++ b/mysql-test/r/system_mysql_db.result
@@ -21,18 +21,18 @@ db CREATE TABLE `db` (
`Host` char(60) collate utf8_bin NOT NULL default '',
`Db` char(64) collate utf8_bin NOT NULL default '',
`User` char(16) collate utf8_bin NOT NULL default '',
- `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges'
@@ -41,18 +41,18 @@ Table Create Table
host CREATE TABLE `host` (
`Host` char(60) collate utf8_bin NOT NULL default '',
`Db` char(64) collate utf8_bin NOT NULL default '',
- `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
+ `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges; Merged with database privileges'
show create table user;
@@ -61,28 +61,28 @@ user CREATE TABLE `user` (
`Host` varchar(60) collate utf8_bin NOT NULL default '',
`User` varchar(16) collate utf8_bin NOT NULL default '',
`Password` varchar(41) collate utf8_bin NOT NULL default '',
- `Select_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Insert_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Update_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Delete_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Create_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Drop_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Reload_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Shutdown_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Process_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `File_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Grant_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `References_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Index_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Alter_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Show_db_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Super_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Create_tmp_table_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Lock_tables_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Execute_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Repl_slave_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `Repl_client_priv` enum('N','Y') collate utf8_bin NOT NULL default 'N',
- `ssl_type` enum('','ANY','X509','SPECIFIED') collate utf8_bin NOT NULL default '',
+ `Select_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Insert_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Update_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Delete_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Create_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Drop_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Reload_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Shutdown_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Process_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `File_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Grant_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `References_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Index_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Alter_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Show_db_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Super_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Create_tmp_table_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Lock_tables_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Execute_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Repl_slave_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `Repl_client_priv` enum('N','Y') character set utf8 NOT NULL default 'N',
+ `ssl_type` enum('','ANY','X509','SPECIFIED') character set utf8 NOT NULL default '',
`ssl_cipher` blob NOT NULL,
`x509_issuer` blob NOT NULL,
`x509_subject` blob NOT NULL,
@@ -97,7 +97,7 @@ func CREATE TABLE `func` (
`name` char(64) collate utf8_bin NOT NULL default '',
`ret` tinyint(1) NOT NULL default '0',
`dl` char(128) collate utf8_bin NOT NULL default '',
- `type` enum('function','aggregate') collate utf8_bin NOT NULL default 'function',
+ `type` enum('function','aggregate') character set utf8 NOT NULL default 'function',
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions'
show create table tables_priv;
@@ -109,8 +109,8 @@ tables_priv CREATE TABLE `tables_priv` (
`Table_name` char(64) collate utf8_bin NOT NULL default '',
`Grantor` char(77) collate utf8_bin NOT NULL default '',
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') collate utf8_bin NOT NULL default '',
- `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '',
+ `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') character set utf8 NOT NULL default '',
+ `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges'
@@ -123,7 +123,7 @@ columns_priv CREATE TABLE `columns_priv` (
`Table_name` char(64) collate utf8_bin NOT NULL default '',
`Column_name` char(64) collate utf8_bin NOT NULL default '',
`Timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- `Column_priv` set('Select','Insert','Update','References') collate utf8_bin NOT NULL default '',
+ `Column_priv` set('Select','Insert','Update','References') character set utf8 NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges'
show tables;
diff --git a/mysql-test/r/timezone2.result b/mysql-test/r/timezone2.result
index 86264bf5b7e..206ff79e7ba 100644
--- a/mysql-test/r/timezone2.result
+++ b/mysql-test/r/timezone2.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, t2;
create table t1 (ts timestamp);
set time_zone='+00:00';
select unix_timestamp(utc_timestamp())-unix_timestamp(current_timestamp());
@@ -256,18 +256,58 @@ delete from mysql.db where user like 'mysqltest\_%';
delete from mysql.tables_priv where user like 'mysqltest\_%';
delete from mysql.columns_priv where user like 'mysqltest\_%';
flush privileges;
-grant usage on mysqltest.* to mysqltest_1@localhost;
+create table t1 (a int, b datetime);
+create table t2 (c int, d datetime);
+grant all privileges on test.* to mysqltest_1@localhost;
show grants for current_user();
Grants for mysqltest_1@localhost
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'localhost'
set time_zone= '+00:00';
set time_zone= 'Europe/Moscow';
select convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC');
convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
2004-10-21 15:00:00
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+convert_tz(b, 'Europe/Moscow', 'UTC')
+update t1, t2 set t1.b = convert_tz('2004-10-21 19:00:00', 'Europe/Moscow', 'UTC')
+where t1.a = t2.c and t2.d = (select max(d) from t2);
select * from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
select Name, convert_tz('2004-10-21 19:00:00', Name, 'UTC') from mysql.time_zone_name;
ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql'
+delete from mysql.db where user like 'mysqltest\_%';
+flush privileges;
+grant all privileges on test.t1 to mysqltest_1@localhost;
+grant all privileges on test.t2 to mysqltest_1@localhost;
+show grants for current_user();
+Grants for mysqltest_1@localhost
+GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `test`.`t2` TO 'mysqltest_1'@'localhost'
+GRANT ALL PRIVILEGES ON `test`.`t1` TO 'mysqltest_1'@'localhost'
+set time_zone= '+00:00';
+set time_zone= 'Europe/Moscow';
+select convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC');
+convert_tz('2004-11-31 12:00:00', 'Europe/Moscow', 'UTC')
+2004-12-01 09:00:00
+select convert_tz(b, 'Europe/Moscow', 'UTC') from t1;
+convert_tz(b, 'Europe/Moscow', 'UTC')
+update t1, t2 set t1.b = convert_tz('2004-11-30 12:00:00', 'Europe/Moscow', 'UTC')
+where t1.a = t2.c and t2.d = (select max(d) from t2);
+select * from mysql.time_zone_name;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
+select Name, convert_tz('2004-11-30 12:00:00', Name, 'UTC') from mysql.time_zone_name;
+ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'time_zone_name'
delete from mysql.user where user like 'mysqltest\_%';
+delete from mysql.db where user like 'mysqltest\_%';
+delete from mysql.tables_priv where user like 'mysqltest\_%';
flush privileges;
+drop table t1, t2;
+select convert_tz('2005-01-14 17:00:00', 'UTC', custTimeZone) from (select 'UTC' as custTimeZone) as tmp;
+convert_tz('2005-01-14 17:00:00', 'UTC', custTimeZone)
+2005-01-14 17:00:00
+create table t1 select convert_tz(NULL, NULL, NULL);
+select * from t1;
+convert_tz(NULL, NULL, NULL)
+NULL
+drop table t1;
diff --git a/mysql-test/r/timezone3.result b/mysql-test/r/timezone3.result
new file mode 100644
index 00000000000..ec0b6045f93
--- /dev/null
+++ b/mysql-test/r/timezone3.result
@@ -0,0 +1,41 @@
+drop table if exists t1;
+create table t1 (i int, c varchar(20));
+insert into t1 values
+(unix_timestamp("2004-01-01 00:00:00"), "2004-01-01 00:00:00");
+insert into t1 values
+(unix_timestamp("2004-03-28 01:59:59"), "2004-03-28 01:59:59"),
+(unix_timestamp("2004-03-28 02:30:00"), "2004-03-28 02:30:00"),
+(unix_timestamp("2004-03-28 03:00:00"), "2004-03-28 03:00:00");
+insert into t1 values
+(unix_timestamp('2004-05-01 00:00:00'),'2004-05-01 00:00:00');
+insert into t1 values
+(unix_timestamp('2004-10-31 01:00:00'),'2004-10-31 01:00:00'),
+(unix_timestamp('2004-10-31 02:00:00'),'2004-10-31 02:00:00'),
+(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59'),
+(unix_timestamp('2004-10-31 04:00:00'),'2004-10-31 04:00:00'),
+(unix_timestamp('2004-10-31 02:59:59'),'2004-10-31 02:59:59');
+insert into t1 values
+(unix_timestamp('1981-07-01 03:59:59'),'1981-07-01 03:59:59'),
+(unix_timestamp('1981-07-01 04:00:00'),'1981-07-01 04:00:00');
+select i, from_unixtime(i), c from t1;
+i from_unixtime(i) c
+1072904422 2004-01-01 00:00:00 2004-01-01 00:00:00
+1080428421 2004-03-28 01:59:59 2004-03-28 01:59:59
+1080428422 2004-03-28 03:00:00 2004-03-28 02:30:00
+1080428422 2004-03-28 03:00:00 2004-03-28 03:00:00
+1083355222 2004-05-01 00:00:00 2004-05-01 00:00:00
+1099170022 2004-10-31 01:00:00 2004-10-31 01:00:00
+1099177222 2004-10-31 02:00:00 2004-10-31 02:00:00
+1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
+1099184422 2004-10-31 04:00:00 2004-10-31 04:00:00
+1099180821 2004-10-31 02:59:59 2004-10-31 02:59:59
+362793608 1981-07-01 03:59:59 1981-07-01 03:59:59
+362793610 1981-07-01 04:00:00 1981-07-01 04:00:00
+drop table t1;
+create table t1 (ts timestamp);
+insert into t1 values (19730101235900), (20040101235900);
+select * from t1;
+ts
+1973-01-01 23:59:00
+2004-01-01 23:59:00
+drop table t1;
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 95bba1d4ec7..8a0c74b3ae5 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -682,8 +682,8 @@ id txt
3 NULL
1 Chevy
drop table t1;
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
-INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';
max(i)
4
diff --git a/mysql-test/r/type_blob.result.es b/mysql-test/r/type_blob.result.es
index 84d02b4a4b4..a510eee8f38 100644
--- a/mysql-test/r/type_blob.result.es
+++ b/mysql-test/r/type_blob.result.es
@@ -684,8 +684,8 @@ id txt
3 NULL
1 Chevy
drop table t1;
-CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1)));
-INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
+CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
+INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = '';
max(i)
4
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 71d1b9ad381..3428b5969d9 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -96,3 +96,11 @@ f2
19781126
19781126
DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (y YEAR);
+INSERT INTO t1 VALUES ('abc');
+Warnings:
+Warning 1265 Data truncated for column 'y' at row 1
+SELECT * FROM t1;
+y
+0000
+DROP TABLE t1;
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 524bc9c50d4..7b101d31fc5 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -97,13 +97,15 @@ select * from t1 where a is null or b is null;
a b
drop table t1;
create table t1 (t datetime);
-insert into t1 values (20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
+insert into t1 values (20030102030460),(20030102036301),(20030102240401),
+(20030132030401),(20031302030401),(100001202030401);
Warnings:
Warning 1265 Data truncated for column 't' at row 1
Warning 1265 Data truncated for column 't' at row 2
Warning 1265 Data truncated for column 't' at row 3
Warning 1265 Data truncated for column 't' at row 4
Warning 1265 Data truncated for column 't' at row 5
+Warning 1265 Data truncated for column 't' at row 6
select * from t1;
t
0000-00-00 00:00:00
@@ -111,14 +113,18 @@ t
0000-00-00 00:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
+0000-00-00 00:00:00
delete from t1;
-insert into t1 values ("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
+insert into t1 values
+("2003-01-02 03:04:60"),("2003-01-02 03:63:01"),("2003-01-02 24:04:01"),
+("2003-01-32 03:04:01"),("2003-13-02 03:04:01"), ("10000-12-02 03:04:00");
Warnings:
Warning 1264 Data truncated; out of range for column 't' at row 1
Warning 1264 Data truncated; out of range for column 't' at row 2
Warning 1264 Data truncated; out of range for column 't' at row 3
Warning 1264 Data truncated; out of range for column 't' at row 4
Warning 1264 Data truncated; out of range for column 't' at row 5
+Warning 1264 Data truncated; out of range for column 't' at row 6
select * from t1;
t
0000-00-00 00:00:00
@@ -126,6 +132,7 @@ t
0000-00-00 00:00:00
0000-00-00 00:00:00
0000-00-00 00:00:00
+0000-00-00 00:00:00
delete from t1;
insert into t1 values ("0000-00-00 00:00:00 some trailer"),("2003-01-01 00:00:00 some trailer");
Warnings:
@@ -136,3 +143,13 @@ t
0000-00-00 00:00:00
2003-01-01 00:00:00
drop table t1;
+create table t1 (dt datetime);
+insert into t1 values ("12-00-00"), ("00-00-00 01:00:00");
+insert into t1 values ("00-00-00"), ("00-00-00 00:00:00");
+select * from t1;
+dt
+2012-00-00 00:00:00
+2000-00-00 01:00:00
+0000-00-00 00:00:00
+0000-00-00 00:00:00
+drop table t1;
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index da85ffe6495..14d3443bda9 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1693,3 +1693,55 @@ oe
ue
ss
DROP TABLE t1;
+CREATE TABLE t1 (
+a ENUM('ä','ö','ü') character set utf8 default 'ü'
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('ä','ö','ü') character set utf8 default 'ü'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('ä'), ('ö'), ('ü');
+select a from t1 order by a;
+a
+drop table t1;
+set names utf8;
+CREATE TABLE t1 (
+a ENUM('ä','ö','ü') character set latin1 default 'ü'
+);
+insert into t1 values ('ä'),('ö'),('ü');
+set names latin1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('ä','ö','ü') default 'ü'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select a from t1 order by a;
+a
+drop table t1;
+create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
+insert into t1 values ('Y');
+alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
+select * from t1;
+Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
+def test t1 t1 a a 254 1 1 Y 384 0 8
+def test t1 t1 b b 254 3 0 Y 2176 0 8
+def test t1 t1 c c 254 1 0 Y 384 0 8
+a b c
+Y NULL NULL
+drop table t1;
+create table t1 (a enum('x','y') default 'x');
+alter table t1 alter a set default 'z';
+ERROR 42000: Invalid default value for 'a'
+drop table t1;
+create table t1 (a set('x','y') default 'x');
+alter table t1 alter a set default 'z';
+ERROR 42000: Invalid default value for 'a'
+drop table t1;
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index 75f0298797a..c1cefe4b35d 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1,t2;
SELECT 10,10.0,10.,.1e+2,100.0e-1;
10 10.0 10. .1e+2 100.0e-1
10 10.0 10 10 10
@@ -8,6 +8,15 @@ SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
1e1 1.e1 1.0e1 1e+1 1.e+1 1.0e+1 1e-1 1.e-1 1.0e-1
10 10 10 10 10 10 0.1 0.1 0.1
+SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01;
+0.001e+1 0.001e-1 -0.001e+01 -0.001e-01
+0.01 0.0001 -0.01 -0.0001
+SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0;
+123.23E+02 -123.23E-02 "123.23E+02"+0.0 "-123.23E-02"+0.0
+12323 -1.2323 12323 -1.2323
+SELECT 2147483647E+02,21474836.47E+06;
+2147483647E+02 21474836.47E+06
+214748364700 21474836470000
create table t1 (f1 float(24),f2 float(52));
show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment
@@ -22,14 +31,14 @@ select * from t1;
f1 f2
10 10
100000 100000
-1.23457e+09 1234567890
+1.23457e+9 1234567890
1e+10 10000000000
1e+15 1e+15
1e+20 1e+20
3.40282e+38 1e+50
3.40282e+38 1e+150
-10 -10
-1e-05 1e-05
+1e-5 1e-5
1e-10 1e-10
1e-15 1e-15
1e-20 1e-20
@@ -139,7 +148,90 @@ create table t1 (c20 char);
insert into t1 values (5000.0);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
+insert into t1 values (0.5e4);
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
+create table t1 (d1 double, d2 double unsigned);
+insert into t1 set d1 = -1.0;
+update t1 set d2 = d1;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'd2' at row 1
+select * from t1;
+d1 d2
+-1 0
+drop table t1;
+create table t1 (f float(4,3));
+insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f' at row 1
+Warning 1264 Data truncated; out of range for column 'f' at row 2
+Warning 1264 Data truncated; out of range for column 'f' at row 3
+Warning 1264 Data truncated; out of range for column 'f' at row 4
+Warning 1264 Data truncated; out of range for column 'f' at row 5
+Warning 1264 Data truncated; out of range for column 'f' at row 6
+select * from t1;
+f
+-9.999
+-9.999
+-9.999
+9.999
+9.999
+9.999
+drop table if exists t1;
+create table t1 (f double(4,3));
+insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f' at row 1
+Warning 1264 Data truncated; out of range for column 'f' at row 2
+Warning 1264 Data truncated; out of range for column 'f' at row 3
+Warning 1264 Data truncated; out of range for column 'f' at row 4
+Warning 1264 Data truncated; out of range for column 'f' at row 5
+Warning 1264 Data truncated; out of range for column 'f' at row 6
+select * from t1;
+f
+-9.999
+-9.999
+-9.999
+9.999
+9.999
+9.999
+drop table if exists t1;
+create table t1 (c char(20));
+insert into t1 values (5e-28);
+select * from t1;
+c
+5e-28
+drop table t1;
+create table t1 (c char(6));
+insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
+select * from t1;
+c
+200000
+2e+06
+0.0002
+2e-05
+drop table t1;
+CREATE TABLE t1 (
+reckey int unsigned NOT NULL,
+recdesc varchar(50) NOT NULL,
+PRIMARY KEY (reckey)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES (108, 'Has 108 as key');
+INSERT INTO t1 VALUES (109, 'Has 109 as key');
+select * from t1 where reckey=108;
+reckey recdesc
+108 Has 108 as key
+select * from t1 where reckey=1.08E2;
+reckey recdesc
+108 Has 108 as key
+select * from t1 where reckey=109;
+reckey recdesc
+109 Has 109 as key
+select * from t1 where reckey=1.09E2;
+reckey recdesc
+109 Has 109 as key
+drop table t1;
diff --git a/mysql-test/r/type_float.result.es b/mysql-test/r/type_float.result.es
index 411817bbfef..5fcf9213f83 100644
--- a/mysql-test/r/type_float.result.es
+++ b/mysql-test/r/type_float.result.es
@@ -22,14 +22,14 @@ select * from t1;
f1 f2
10 10
100000 100000
-1.23457e+09 1234567890
+1.23457e+9 1234567890
1e+10 10000000000
1e+15 1e+15
1e+20 1e+20
3.40282e+38 1e+50
3.40282e+38 1e+150
-10 -10
-1e-05 1e-05
+1e-5 1e-5
1e-10 1e-10
1e-15 1e-15
1e-20 1e-20
@@ -137,7 +137,69 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (c20 char);
insert into t1 values (5000.0);
+Warnings:
+Warning 1265 Data truncated for column 'c20' at row 1
drop table t1;
create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f'
drop table if exists t1;
+create table t1 (d1 double, d2 double unsigned);
+insert into t1 set d1 = -1.0;
+update t1 set d2 = d1;
+Warnings:
+Warning 1264 Data truncated; out of range for column 'd2' at row 1
+select * from t1;
+d1 d2
+-1 0
+drop table t1;
+create table t1 (f float(4,3));
+insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f' at row 1
+Warning 1264 Data truncated; out of range for column 'f' at row 2
+Warning 1264 Data truncated; out of range for column 'f' at row 3
+Warning 1264 Data truncated; out of range for column 'f' at row 4
+Warning 1264 Data truncated; out of range for column 'f' at row 5
+Warning 1264 Data truncated; out of range for column 'f' at row 6
+select * from t1;
+f
+-9.999
+-9.999
+-9.999
+9.999
+9.999
+9.999
+drop table if exists t1;
+create table t1 (f double(4,3));
+insert into t1 values (-11.0),(-11),("-11"),(11.0),(11),("11");
+Warnings:
+Warning 1264 Data truncated; out of range for column 'f' at row 1
+Warning 1264 Data truncated; out of range for column 'f' at row 2
+Warning 1264 Data truncated; out of range for column 'f' at row 3
+Warning 1264 Data truncated; out of range for column 'f' at row 4
+Warning 1264 Data truncated; out of range for column 'f' at row 5
+Warning 1264 Data truncated; out of range for column 'f' at row 6
+select * from t1;
+f
+-9.999
+-9.999
+-9.999
+9.999
+9.999
+9.999
+drop table if exists t1;
+create table t1 (c char(20));
+insert into t1 values (5e-28);
+select * from t1;
+c
+5e-28
+drop table t1;
+create table t1 (c char(6));
+insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
+select * from t1;
+c
+200000
+2e+06
+0.0002
+2e-05
+drop table t1;
diff --git a/mysql-test/r/type_set.result b/mysql-test/r/type_set.result
index 9c82f59fc69..5aedefda283 100644
--- a/mysql-test/r/type_set.result
+++ b/mysql-test/r/type_set.result
@@ -29,6 +29,12 @@ a
A
a,A
a,A
+select s from t1 order by concat(s);
+s
+A
+a
+a,A
+a,A
drop table t1;
CREATE TABLE t1 (c set('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
@@ -47,4 +53,16 @@ ss
ss
ae,oe,ue,ss
ae,oe,ue,ss
+SELECT c FROM t1 ORDER BY concat(c);
+c
+ae
+ae
+ae,oe,ue,ss
+ae,oe,ue,ss
+oe
+oe
+ss
+ss
+ue
+ue
DROP TABLE t1;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 42fdc7e50c6..6c46d308e7e 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -422,3 +422,13 @@ max(t)
2004-01-01 01:00:00
2004-02-01 00:00:00
drop table t1;
+set sql_mode='maxdb';
+create table t1 (a timestamp, b timestamp(19));
+show create table t1;
+Table Create Table
+t1 CREATE TABLE "t1" (
+ "a" datetime default NULL,
+ "b" datetime default NULL
+)
+set sql_mode='';
+drop table t1;
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 7820cd1d6ff..f58f0f5b0ac 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -554,7 +554,7 @@ aa
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `a` char(20) NOT NULL default ''
+ `a` binary(20) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -872,6 +872,22 @@ count(*)
show status like 'Slow_queries';
Variable_name Value
Slow_queries 3
+flush status;
+select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
+a
+4
+5
+3
+6
+7
+8
+9
+10
+1
+2
+show status like 'Slow_queries';
+Variable_name Value
+Slow_queries 1
drop table t1;
create table t1 ( RID int(11) not null default '0', IID int(11) not null default '0', nada varchar(50) not null,NAME varchar(50) not null,PHONE varchar(50) not null) engine=MyISAM;
insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
@@ -1110,4 +1126,72 @@ t1 CREATE TABLE `t1` (
`a` char(1) character set latin1 collate latin1_german1_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 as
+(select a from t2) union
+(select b from t2) union
+(select 'c' collate latin1_german1_ci from t2);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) character set latin1 collate latin1_german1_ci default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
drop table t2;
+create table t1(a1 int, f1 char(10));
+create table t2
+select f2,a1 from (select a1, CAST('2004-12-31' AS DATE) f2 from t1) a
+union
+select f2,a1 from (select a1, CAST('2004-12-31' AS DATE) f2 from t1) a
+order by f2, a1;
+show columns from t2;
+Field Type Null Key Default Extra
+f2 date YES NULL
+a1 int(11) YES NULL
+drop table t1, t2;
+create table t1 (f1 int);
+create table t2 (f1 int, f2 int ,f3 date);
+create table t3 (f1 int, f2 char(10));
+create table t4
+(
+select t2.f3 as sdate
+from t1
+left outer join t2 on (t1.f1 = t2.f1)
+inner join t3 on (t2.f2 = t3.f1)
+order by t1.f1, t3.f1, t2.f3
+)
+union
+(
+select cast('2004-12-31' as date) as sdate
+from t1
+left outer join t2 on (t1.f1 = t2.f1)
+inner join t3 on (t2.f2 = t3.f1)
+group by t1.f1
+order by t1.f1, t3.f1, t2.f3
+)
+order by sdate;
+show columns from t4;
+Field Type Null Key Default Extra
+sdate date YES NULL
+drop table t1, t2, t3, t4;
+create table t1 (a int not null, b char (10) not null);
+insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
+select * from ((select * from t1 limit 1)) a;
+a b
+1 a
+select * from ((select * from t1 limit 1) union (select * from t1 limit 1)) a;
+a b
+1 a
+select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union (select * from t1 limit 1)) a;
+a b
+1 a
+select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a;
+a b
+1 a
+2 b
+3 c
+select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a;
+a b
+1 a
+2 b
+3 c
+drop table t1;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 6d2e623a6fb..ac370db9ecc 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -206,3 +206,16 @@ colC colA colD colE colF
3 4433 10005 492 500
DROP TABLE t1;
DROP TABLE t2;
+create table t1 (c1 int, c2 char(6), c3 int);
+create table t2 (c1 int, c2 char(6));
+insert into t1 values (1, "t1c2-1", 10), (2, "t1c2-2", 20);
+update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1";
+update t1 left join t2 on t1.c1 = t2.c1 set t2.c2 = "t2c2-1" where t1.c3 = 10;
+drop table t1, t2;
+create table t1 (id int not null auto_increment primary key, id_str varchar(32));
+insert into t1 (id_str) values ("test");
+update t1 set id_str = concat(id_str, id) where id = last_insert_id();
+select * from t1;
+id id_str
+1 test1
+drop table t1;
diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result
index 2750478c1c5..d82c17b0fe0 100644
--- a/mysql-test/r/user_var.result
+++ b/mysql-test/r/user_var.result
@@ -123,7 +123,7 @@ drop table t1;
set @a=_latin2'test';
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
-latin2 latin2_general_ci 3
+latin2 latin2_general_ci 2
select @a=_latin2'TEST';
@a=_latin2'TEST'
1
@@ -133,12 +133,13 @@ select @a=_latin2'TEST' collate latin2_bin;
set @a=_latin2'test' collate latin2_general_ci;
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
-latin2 latin2_general_ci 0
+latin2 latin2_general_ci 2
select @a=_latin2'TEST';
@a=_latin2'TEST'
1
select @a=_latin2'TEST' collate latin2_bin;
-ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '='
+@a=_latin2'TEST' collate latin2_bin
+0
select charset(@a:=_latin2'test');
charset(@a:=_latin2'test')
latin2
@@ -147,51 +148,48 @@ collation(@a:=_latin2'test')
latin2_general_ci
select coercibility(@a:=_latin2'test');
coercibility(@a:=_latin2'test')
-3
+2
select collation(@a:=_latin2'test' collate latin2_bin);
collation(@a:=_latin2'test' collate latin2_bin)
latin2_bin
select coercibility(@a:=_latin2'test' collate latin2_bin);
coercibility(@a:=_latin2'test' collate latin2_bin)
-0
+2
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST';
(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'
0
select charset(@a),collation(@a),coercibility(@a);
charset(@a) collation(@a) coercibility(@a)
-latin2 latin2_bin 0
+latin2 latin2_bin 2
select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci;
-ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '='
+(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci
+1
create table t1 (a varchar(50));
reset master;
SET TIMESTAMP=10000;
SET @`a b`='hello';
INSERT INTO t1 VALUES(@`a b`);
set @var1= "';aaa";
-insert into t1 values (@var1);
-create table t2 (c char(30)) charset=ucs2;
-set @v=convert('abc' using ucs2);
-insert into t2 values (@v);
+SET @var2=char(ascii('a'));
+insert into t1 values (@var1),(@var2);
show binlog events from 79;
Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.000001 79 User var 1 79 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 120 Query 1 120 use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 184 User var 1 184 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
-master-bin.000001 226 Query 1 226 use `test`; insert into t1 values (@var1)
-master-bin.000001 290 Query 1 290 use `test`; create table t2 (c char(30)) charset=ucs2
-master-bin.000001 366 User var 1 366 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
-master-bin.000001 406 Query 1 406 use `test`; insert into t2 values (@v)
+master-bin.000001 226 User var 1 226 @`var2`=_latin1 0x61 COLLATE latin1_swedish_ci
+master-bin.000001 264 Query 1 264 use `test`; insert into t1 values (@var1),(@var2)
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
-SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
+SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`;
use test;
SET TIMESTAMP=10000;
INSERT INTO t1 VALUES(@`a b`);
-SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci;
-SET TIMESTAMP=10000;
-insert into t1 values (@var1);
-SET TIMESTAMP=10000;
-create table t2 (c char(30)) charset=ucs2;
-SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
+SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`;
+SET @`var2`:=_latin1 0x61 COLLATE `latin1_swedish_ci`;
SET TIMESTAMP=10000;
-insert into t2 values (@v);
-drop table t1, t2;
+insert into t1 values (@var1),(@var2);
+drop table t1;
+set @var= NULL ;
+select FIELD( @var,'1it','Hit') as my_column;
+my_column
+0
diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result
index b2a97ce3e48..633f7c139fd 100644
--- a/mysql-test/r/variables.result
+++ b/mysql-test/r/variables.result
@@ -115,13 +115,13 @@ set global concurrent_insert=DEFAULT;
show variables like 'concurrent_insert';
Variable_name Value
concurrent_insert ON
-set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="INNODB";
+set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
show local variables like 'storage_engine';
Variable_name Value
storage_engine HEAP
show global variables like 'storage_engine';
Variable_name Value
-storage_engine InnoDB
+storage_engine MERGE
set GLOBAL query_cache_size=100000;
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
@@ -220,7 +220,7 @@ set max_join_size="hello";
ERROR 42000: Incorrect argument type to variable 'max_join_size'
set storage_engine=UNKNOWN_TABLE_TYPE;
ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
-set storage_engine=INNODB, big_tables=2;
+set storage_engine=MERGE, big_tables=2;
ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
show local variables like 'storage_engine';
Variable_name Value
@@ -478,3 +478,12 @@ t1 CREATE TABLE `t1` (
`c3` longtext
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+SET GLOBAL MYISAM_DATA_POINTER_SIZE= 8;
+SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
+Variable_name Value
+myisam_data_pointer_size 8
+SET GLOBAL table_cache=-1;
+SHOW VARIABLES LIKE 'table_cache';
+Variable_name Value
+table_cache 1
+SET GLOBAL table_cache=DEFAULT;
diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
index d883feb7ce2..e03d72351d1 100644
--- a/mysql-test/r/warnings.result
+++ b/mysql-test/r/warnings.result
@@ -1,6 +1,33 @@
drop table if exists t1, t2;
SET SQL_WARNINGS=1;
create table t1 (a int);
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+show count(*) errors;
+@@session.error_count
+1
+show errors;
+Level Code Message
+Error 1050 Table 't1' already exists
+show warnings;
+Level Code Message
+Error 1050 Table 't1' already exists
+create table t2(a int) default charset qwerty;
+ERROR 42000: Unknown character set: 'qwerty'
+show count(*) errors;
+@@session.error_count
+1
+show errors;
+Level Code Message
+Error 1115 Unknown character set: 'qwerty'
+create table t (i);
+ERROR 42000: 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 ')' at line 1
+show count(*) errors;
+@@session.error_count
+1
+show errors;
+Level Code Message
+Error 1064 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 ')' at line 1
insert into t1 values (1);
insert into t1 values ("hej");
Warnings: