summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysqltest.c28
-rwxr-xr-xmysql-test/mysql-test-run.pl6
-rwxr-xr-xmysql-test/r/ctype_cp932.result10
-rw-r--r--mysql-test/r/default.result12
-rw-r--r--mysql-test/r/gis.result4
-rw-r--r--mysql-test/r/information_schema.result40
-rw-r--r--mysql-test/r/innodb-ucs2.result313
-rw-r--r--mysql-test/r/innodb.result312
-rw-r--r--mysql-test/r/innodb_mysql.result27
-rw-r--r--mysql-test/r/insert_select.result26
-rw-r--r--mysql-test/r/join_outer.result20
-rw-r--r--mysql-test/r/loaddata.result16
-rw-r--r--mysql-test/r/mysql.result10
-rw-r--r--mysql-test/r/mysqlbinlog-cp932.result19
-rw-r--r--mysql-test/r/mysqlbinlog.result20
-rw-r--r--mysql-test/r/order_by.result24
-rw-r--r--mysql-test/r/outfile.resultbin1159 -> 1382 bytes
-rw-r--r--mysql-test/r/query_cache.result2
-rw-r--r--mysql-test/r/select.result28
-rw-r--r--mysql-test/r/sp-ucs2.result14
-rw-r--r--mysql-test/r/sp.result14
-rw-r--r--mysql-test/r/type_blob.result24
-rw-r--r--mysql-test/r/update.result57
-rw-r--r--mysql-test/r/view.result103
-rw-r--r--mysql-test/t/ctype_cp932.test14
-rw-r--r--mysql-test/t/ctype_ucs2_def-master.opt2
-rw-r--r--mysql-test/t/ctype_ucs2_def.test2
-rw-r--r--mysql-test/t/default.test9
-rw-r--r--mysql-test/t/gis.test9
-rw-r--r--mysql-test/t/information_schema.test24
-rw-r--r--mysql-test/t/innodb-ucs2.test226
-rw-r--r--mysql-test/t/innodb.test222
-rw-r--r--mysql-test/t/innodb_mysql.test26
-rw-r--r--mysql-test/t/insert_select.test26
-rw-r--r--mysql-test/t/join_outer.test23
-rw-r--r--mysql-test/t/loaddata.test23
-rw-r--r--mysql-test/t/mysql.test14
-rw-r--r--mysql-test/t/mysqlbinlog-cp932-master.opt1
-rw-r--r--mysql-test/t/mysqlbinlog-cp932.test19
-rw-r--r--mysql-test/t/mysqlbinlog.test27
-rw-r--r--mysql-test/t/order_by.test31
-rw-r--r--mysql-test/t/outfile.test12
-rw-r--r--mysql-test/t/query_cache.test4
-rw-r--r--mysql-test/t/select.test23
-rw-r--r--mysql-test/t/sp-ucs2.test28
-rw-r--r--mysql-test/t/sp.test25
-rw-r--r--mysql-test/t/type_blob.test27
-rw-r--r--mysql-test/t/update.test35
-rw-r--r--mysql-test/t/view.test74
-rw-r--r--mysys/my_pthread.c2
-rw-r--r--sql/Makefile.am3
-rw-r--r--sql/field.h4
-rw-r--r--sql/field_conv.cc15
-rw-r--r--sql/item.cc41
-rw-r--r--sql/item_cmpfunc.cc8
-rw-r--r--sql/item_cmpfunc.h1
-rw-r--r--sql/item_strfunc.cc5
-rw-r--r--sql/mysql_priv.h5
-rw-r--r--sql/mysqld.cc51
-rw-r--r--sql/opt_range.cc45
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/sql_class.cc12
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_insert.cc28
-rw-r--r--sql/sql_lex.cc1
-rw-r--r--sql/sql_load.cc9
-rw-r--r--sql/sql_select.cc20
-rw-r--r--sql/sql_show.cc28
-rw-r--r--sql/sql_update.cc11
-rw-r--r--sql/sql_view.cc1
-rw-r--r--sql/table.cc2
-rw-r--r--sql/table.h8
72 files changed, 1600 insertions, 761 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index e2d2f0f45a6..8aef19f600b 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -416,6 +416,8 @@ void verbose_msg(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
void warning_msg(const char *fmt, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
+void log_msg(const char *fmt, ...)
+ ATTRIBUTE_FORMAT(printf, 1, 2);
VAR* var_from_env(const char *, const char *);
VAR* var_init(VAR* v, const char *name, int name_len, const char *val,
@@ -578,6 +580,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
dynstr_append_mem(query_eval, p, 1);
break;
default:
+ escaped= 0;
dynstr_append_mem(query_eval, p, 1);
break;
}
@@ -943,6 +946,25 @@ void warning_msg(const char *fmt, ...)
}
+void log_msg(const char *fmt, ...)
+{
+ va_list args;
+ char buff[512];
+ size_t len;
+ DBUG_ENTER("log_msg");
+
+ memset(buff, 0, sizeof(buff));
+ va_start(args, fmt);
+ len= my_vsnprintf(buff, sizeof(buff)-1, fmt, args);
+ va_end(args);
+
+ dynstr_append_mem(&ds_res, buff, len);
+ dynstr_append(&ds_res, "\n");
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Compare content of the string ds to content of file fname
*/
@@ -1615,7 +1637,11 @@ void do_exec(struct st_command *command)
my_bool ok= 0;
if (command->abort_on_error)
+ {
+ log_msg("exec of '%s failed, error: %d, status: %d, errno: %d",
+ ds_cmd.str, error, status, errno);
die("command \"%s\" failed", command->first_argument);
+ }
DBUG_PRINT("info",
("error: %d, status: %d", error, status));
@@ -1639,6 +1665,8 @@ void do_exec(struct st_command *command)
command->expected_errors.err[0].code.errnum != 0)
{
/* Error code we wanted was != 0, i.e. not an expected success */
+ log_msg("exec of '%s failed, error: %d, errno: %d",
+ ds_cmd.str, error, errno);
die("command \"%s\" succeeded - should have failed with errno %d...",
command->first_argument, command->expected_errors.err[0].code.errnum);
}
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 2c66b148dcd..95f67151a0b 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -3581,6 +3581,12 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
+ if ( $mysql_version_id >= 50036)
+ {
+ # Prevent the started mysqld to access files outside of vardir
+ mtr_add_arg($args, "%s--secure-file-priv=%s", $prefix, $opt_vardir);
+ }
+
if ( $mysql_version_id >= 50000 )
{
mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result
index ed57b87c1ba..01b7fab2aba 100755
--- a/mysql-test/r/ctype_cp932.result
+++ b/mysql-test/r/ctype_cp932.result
@@ -11353,3 +11353,13 @@ a
a
a
drop table t1;
+ƒ\
+ƒ\
+c_cp932
+ƒ\
+ƒ\
+ƒ\
+ソ
+ソ
+ƒ\
+ƒ\
diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result
index e2aa3b4a3cc..0b2b6769505 100644
--- a/mysql-test/r/default.result
+++ b/mysql-test/r/default.result
@@ -193,6 +193,16 @@ a b c d e f g h i x
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 1
small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 2
two large 00:00:05 0007-01-01 11 13 17 0019-01-01 00:00:00 23 3
- small 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
+ 00:00:00 0000-00-00 0 0000-00-00 00:00:00 0 4
drop table bug20691;
+create table t1 (id int not null);
+insert into t1 values(default);
+Warnings:
+Warning 1364 Field 'id' doesn't have a default value
+create view v1 (c) as select id from t1;
+insert into t1 values(default);
+Warnings:
+Warning 1364 Field 'id' doesn't have a default value
+drop view v1;
+drop table t1;
End of 5.0 tests.
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 870e160e563..df39a4d8ca2 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -717,3 +717,7 @@ desc t1;
Field Type Null Key Default Extra
GeomFromText('point(1 1)') geometry NO
drop table t1;
+create table t1 (g geometry not null);
+insert into t1 values(default);
+ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
+drop table t1;
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index b93a4c28849..436bb70d0e7 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1262,8 +1262,7 @@ from information_schema.tables
order by object_schema;
explain select * from v1;
id select_type table type possible_keys key key_len ref rows Extra
-1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
-2 DERIVED tables ALL NULL NULL NULL NULL 2 Using filesort
+1 SIMPLE tables ALL NULL NULL NULL NULL 2 Using filesort
explain select * from (select table_name from information_schema.tables) as a;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found
@@ -1279,3 +1278,40 @@ table_name
t1
t2
drop table t1,t2;
+select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
+(select cast(table_name as char) from information_schema.tables
+order by table_name limit 1) limit 1;
+f1
+1
+select t.table_name, group_concat(t.table_schema, '.', t.table_name),
+count(*) as num1
+from information_schema.tables t
+inner join information_schema.columns c1
+on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
+where t.table_schema = 'information_schema' and
+c1.ordinal_position =
+(select isnull(c2.column_type) -
+isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
+count(*) as num
+from information_schema.columns c2 where
+c2.table_schema='information_schema' and
+(c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
+group by c2.column_type order by num limit 1)
+group by t.table_name order by num1, t.table_name;
+table_name group_concat(t.table_schema, '.', t.table_name) num1
+CHARACTER_SETS information_schema.CHARACTER_SETS 1
+COLLATIONS information_schema.COLLATIONS 1
+COLLATION_CHARACTER_SET_APPLICABILITY information_schema.COLLATION_CHARACTER_SET_APPLICABILITY 1
+COLUMNS information_schema.COLUMNS 1
+COLUMN_PRIVILEGES information_schema.COLUMN_PRIVILEGES 1
+KEY_COLUMN_USAGE information_schema.KEY_COLUMN_USAGE 1
+ROUTINES information_schema.ROUTINES 1
+SCHEMATA information_schema.SCHEMATA 1
+SCHEMA_PRIVILEGES information_schema.SCHEMA_PRIVILEGES 1
+STATISTICS information_schema.STATISTICS 1
+TABLES information_schema.TABLES 1
+TABLE_CONSTRAINTS information_schema.TABLE_CONSTRAINTS 1
+TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1
+TRIGGERS information_schema.TRIGGERS 1
+USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
+VIEWS information_schema.VIEWS 1
diff --git a/mysql-test/r/innodb-ucs2.result b/mysql-test/r/innodb-ucs2.result
new file mode 100644
index 00000000000..a1c73c912b2
--- /dev/null
+++ b/mysql-test/r/innodb-ucs2.result
@@ -0,0 +1,313 @@
+create table t1 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05630563 05630563 email
+4 0563 0563 email
+4 05612020 05612020 email
+4 01FC 01FC email
+4 0120 0120 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0000E400 0000E400 email
+4 0000563001FC0563 0000563001FC0563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 05630563 05630563 email
+4 0563 0563 email
+4 05612020 05612020 email
+4 01FC 01FC email
+4 0120 0120 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0000E400 0000E400 email
+4 0000563001FC0563 0000563001FC0563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+4 E880BDD0B1E880BD E880BDD0B1E880BD seven
+4 E880BDE880BD E880BDE880BD six
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0120 0120 email
+4 01FC 01FC email
+4 0563 0563 email
+4 0000563001FC0563 0000563001FC0563 email
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 05612020 05612020 email
+4 05630563 05630563 email
+1 0061006200630064006500660067 0061006200630064006500660067 one
+3 0071007200730074007500760077 0071007200730074007500760077 three
+2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
+drop table t1;
+drop table t2;
+create table t1 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+a hex(b) hex(c) filler
+1 61626364656667 61626364656667 boo
+4 D0B1 D0B1 eight
+4 5B 5B five
+4 E880BD E880BD four
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+select a,hex(b),hex(c),filler from t2 order by filler;
+a hex(b) hex(c) filler
+4 0000E400 0000E400 email
+4 00640065 00640065 email
+4 00E400E50068 00E400E50068 email
+4 0120 0120 email
+4 01FC 01FC email
+4 05612020 05612020 email
+4 0563 0563 email
+1 61626364656667 61626364656667 one
+3 71727374757677 71727374757677 three
+2 696A6B696C6D6E 696A6B696C6D6E two
+drop table t1;
+drop table t2;
+commit;
+CREATE TABLE t1 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind enum('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind set('0','1','2') NOT NULL default '0',
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+hex(ind) hex(string1)
+31
+32
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+hex(ind) hex(string1)
+0031
+0032
+drop table t1,t2;
+CREATE TABLE t1 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ind bit not null,
+string1 varchar(250) NOT NULL,
+PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+hex(ind) hex(string1)
+0
+1
+select hex(ind),hex(string1) from t2 order by string1;
+hex(ind) hex(string1)
+0
+1
+drop table t1,t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = innodb;
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+a hex(b)
+1 61626364656667
+2 6465666768696A6B
+6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
+7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
+update t1 set b = 'three' where a = 6;
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 38d71ac7a42..9abb95e2cc3 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -2673,215 +2673,6 @@ checksum table t1;
Table Checksum
test.t1 2050879373
drop table t1;
-create table t1 (
-a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a hex(b) hex(c) filler
-1 61626364656667 61626364656667 boo
-4 D0B1 D0B1 eight
-4 5B 5B five
-4 E880BD E880BD four
-4 E880BDD0B1E880BD E880BDD0B1E880BD seven
-4 E880BDE880BD E880BDE880BD six
-3 71727374757677 71727374757677 three
-2 696A6B696C6D6E 696A6B696C6D6E two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a hex(b) hex(c) filler
-4 05630563 05630563 email
-4 0563 0563 email
-4 05612020 05612020 email
-4 01FC 01FC email
-4 0120 0120 email
-4 00640065 00640065 email
-4 00E400E50068 00E400E50068 email
-4 0000E400 0000E400 email
-4 0000563001FC0563 0000563001FC0563 email
-1 0061006200630064006500660067 0061006200630064006500660067 one
-3 0071007200730074007500760077 0071007200730074007500760077 three
-2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a hex(b) hex(c) filler
-1 61626364656667 61626364656667 boo
-4 D0B1 D0B1 eight
-4 5B 5B five
-4 E880BD E880BD four
-4 E880BDD0B1E880BD E880BDD0B1E880BD seven
-4 E880BDE880BD E880BDE880BD six
-3 71727374757677 71727374757677 three
-2 696A6B696C6D6E 696A6B696C6D6E two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a hex(b) hex(c) filler
-4 05630563 05630563 email
-4 0563 0563 email
-4 05612020 05612020 email
-4 01FC 01FC email
-4 0120 0120 email
-4 00640065 00640065 email
-4 00E400E50068 00E400E50068 email
-4 0000E400 0000E400 email
-4 0000563001FC0563 0000563001FC0563 email
-1 0061006200630064006500660067 0061006200630064006500660067 one
-3 0071007200730074007500760077 0071007200730074007500760077 three
-2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a hex(b) hex(c) filler
-1 61626364656667 61626364656667 boo
-4 D0B1 D0B1 eight
-4 5B 5B five
-4 E880BD E880BD four
-4 E880BDD0B1E880BD E880BDD0B1E880BD seven
-4 E880BDE880BD E880BDE880BD six
-3 71727374757677 71727374757677 three
-2 696A6B696C6D6E 696A6B696C6D6E two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a hex(b) hex(c) filler
-4 0120 0120 email
-4 01FC 01FC email
-4 0563 0563 email
-4 0000563001FC0563 0000563001FC0563 email
-4 0000E400 0000E400 email
-4 00640065 00640065 email
-4 00E400E50068 00E400E50068 email
-4 05612020 05612020 email
-4 05630563 05630563 email
-1 0061006200630064006500660067 0061006200630064006500660067 one
-3 0071007200730074007500760077 0071007200730074007500760077 three
-2 0069006A006B0069006C006D006E 0069006A006B0069006C006D006E two
-drop table t1;
-drop table t2;
-create table t1 (
-a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
-a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-a hex(b) hex(c) filler
-1 61626364656667 61626364656667 boo
-4 D0B1 D0B1 eight
-4 5B 5B five
-4 E880BD E880BD four
-3 71727374757677 71727374757677 three
-2 696A6B696C6D6E 696A6B696C6D6E two
-select a,hex(b),hex(c),filler from t2 order by filler;
-a hex(b) hex(c) filler
-4 0000E400 0000E400 email
-4 00640065 00640065 email
-4 00E400E50068 00E400E50068 email
-4 0120 0120 email
-4 01FC 01FC email
-4 05612020 05612020 email
-4 0563 0563 email
-1 61626364656667 61626364656667 one
-3 71727374757677 71727374757677 three
-2 696A6B696C6D6E 696A6B696C6D6E two
-drop table t1;
-drop table t2;
-commit;
set foreign_key_checks=0;
create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb;
create table t1(a char(10) primary key, b varchar(20)) engine = innodb;
@@ -3058,109 +2849,6 @@ select hex(s1) from t2;
hex(s1)
12
drop table t2,t1;
-CREATE TABLE t1 (
-ind enum('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind enum('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-hex(ind) hex(string1)
-31
-32
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-hex(ind) hex(string1)
-0031
-0032
-drop table t1,t2;
-CREATE TABLE t1 (
-ind set('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind set('0','1','2') NOT NULL default '0',
-string1 varchar(250) NOT NULL,
-PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-hex(ind) hex(string1)
-31
-32
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-hex(ind) hex(string1)
-0031
-0032
-drop table t1,t2;
-CREATE TABLE t1 (
-ind bit not null,
-string1 varchar(250) NOT NULL,
-PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
-ind bit not null,
-string1 varchar(250) NOT NULL,
-PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-insert into t1 values(0,''),(1,'');
-insert into t2 values(0,''),(1,'');
-select hex(ind),hex(string1) from t1 order by string1;
-hex(ind) hex(string1)
-0
-1
-select hex(ind),hex(string1) from t2 order by string1;
-hex(ind) hex(string1)
-0
-1
-drop table t1,t2;
-create table t2 (
-a int, b char(10), filler char(10), primary key(a, b(2))
-) character set utf8 engine = innodb;
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t2 (
-a int, b char(10), filler char(10), primary key(a, b(2))
-) character set ucs2 engine = innodb;
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-a hex(b)
-1 61626364656667
-2 6465666768696A6B
-6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
-7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
-update t1 set b = 'three' where a = 6;
-drop table t1;
-create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-a hex(b)
-1 61626364656667
-2 6465666768696A6B
-6 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1
-7 D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2
-update t1 set b = 'three' where a = 6;
-drop table t1;
CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB;
CREATE TABLE t2(a INT) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a);
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index f150af4b6c2..298fc58ffcb 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -383,6 +383,33 @@ EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 128 Using filesort
DROP TABLE t1;
+CREATE TABLE t1 (
+id int NOT NULL,
+name varchar(20) NOT NULL,
+dept varchar(20) NOT NULL,
+age tinyint(3) unsigned NOT NULL,
+PRIMARY KEY (id),
+INDEX (name,dept)
+) ENGINE=InnoDB;
+INSERT INTO t1(id, dept, age, name) VALUES
+(3987, 'cs1', 10, 'rs1'), (3988, 'cs2', 20, 'rs1'), (3995, 'cs3', 10, 'rs2'),
+(3996, 'cs4', 20, 'rs2'), (4003, 'cs5', 10, 'rs3'), (4004, 'cs6', 20, 'rs3'),
+(4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'),
+(4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6');
+EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range name name 44 NULL 2 Using where; Using index for group-by
+SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+name dept
+rs5 cs10
+rs5 cs9
+DELETE FROM t1;
+EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range name name 44 NULL 2 Using where; Using index for group-by
+SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+name dept
+DROP TABLE t1;
show variables like 'innodb_rollback_on_timeout';
Variable_name Value
innodb_rollback_on_timeout OFF
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index 1453d25ac75..2e0acf303c2 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -705,3 +705,29 @@ use bug21774_1;
INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
DROP DATABASE bug21774_1;
DROP DATABASE bug21774_2;
+USE test;
+create table t1(f1 int primary key, f2 int);
+insert into t1 values (1,1);
+affected rows: 1
+insert into t1 values (1,1) on duplicate key update f2=1;
+affected rows: 0
+insert into t1 values (1,1) on duplicate key update f2=2;
+affected rows: 2
+select * from t1;
+f1 f2
+1 2
+drop table t1;
+create table t1(f1 int primary key auto_increment, f2 int unique);
+insert into t1(f2) values(1);
+select @@identity;
+@@identity
+1
+insert ignore t1(f2) values(1);
+select @@identity;
+@@identity
+0
+insert ignore t1(f2) select 1;
+select @@identity;
+@@identity
+0
+drop table t1;
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 89bb26c4b3f..df66336bd81 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1194,3 +1194,23 @@ a b
3 3
4 NULL
DROP TABLE t1,t2;
+CREATE TABLE t1 (
+f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
+f2 varchar(16) collate latin1_swedish_ci
+);
+CREATE TABLE t2 (
+f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
+f3 varchar(16) collate latin1_swedish_ci
+);
+INSERT INTO t1 VALUES ('bla','blah');
+INSERT INTO t2 VALUES ('bla','sheep');
+SELECT * FROM t1 JOIN t2 USING(f1) WHERE f1='Bla';
+f1 f2 f3
+bla blah sheep
+SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='bla';
+f1 f2 f3
+bla blah sheep
+SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='Bla';
+f1 f2 f3
+bla blah sheep
+DROP TABLE t1,t2;
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index d415bd468e0..83c7b37d914 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -139,4 +139,20 @@ select * from t1;
a b c
10 NULL Ten
15 NULL Fifteen
+show variables like "secure_file_pri%";
+Variable_name Value
+secure_file_priv MYSQLTEST_VARDIR/
+select @@secure_file_priv;
+@@secure_file_priv
+MYSQLTEST_VARDIR/
+set @@secure_file_priv= 0;
+ERROR HY000: Variable 'secure_file_priv' is a read only variable
+truncate table t1;
+load data infile 'MYSQL_TEST_DIR/Makefile' into table t1;
+ERROR HY000: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
+select * from t1;
+a b c
+select load_file("MYSQL_TEST_DIR/Makefile");
+load_file("MYSQL_TEST_DIR/Makefile")
+NULL
drop table t1, t2;
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
index 3bba1944c52..e83bbe97eaa 100644
--- a/mysql-test/r/mysql.result
+++ b/mysql-test/r/mysql.result
@@ -61,16 +61,6 @@ database()
test
unlock tables;
drop table t1;
-ƒ\
-ƒ\
-c_cp932
-ƒ\
-ƒ\
-ƒ\
-ソ
-ソ
-ƒ\
-ƒ\
+----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+
diff --git a/mysql-test/r/mysqlbinlog-cp932.result b/mysql-test/r/mysqlbinlog-cp932.result
new file mode 100644
index 00000000000..1640a3b1642
--- /dev/null
+++ b/mysql-test/r/mysqlbinlog-cp932.result
@@ -0,0 +1,19 @@
+flush logs;
+create table t3 (f text character set utf8);
+create table t4 (f text character set cp932);
+flush logs;
+rename table t3 to t03, t4 to t04;
+select HEX(f) from t03;
+HEX(f)
+E382BD
+select HEX(f) from t3;
+HEX(f)
+E382BD
+select HEX(f) from t04;
+HEX(f)
+835C
+select HEX(f) from t4;
+HEX(f)
+835C
+drop table t3, t4, t03, t04;
+End of 5.0 tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index b2571ec5d12..28dee9be92c 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -193,23 +193,6 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
flush logs;
-create table t3 (f text character set utf8);
-create table t4 (f text character set cp932);
-flush logs;
-rename table t3 to t03, t4 to t04;
-select HEX(f) from t03;
-HEX(f)
-E382BD
-select HEX(f) from t3;
-HEX(f)
-E382BD
-select HEX(f) from t04;
-HEX(f)
-835C
-select HEX(f) from t4;
-HEX(f)
-835C
-flush logs;
select * from t5 /* must be (1),(1) */;
a
1
@@ -269,4 +252,5 @@ call p1();
1
1
drop procedure p1;
-drop table t1, t2, t03, t04, t3, t4, t5;
+drop table t1, t2, t5;
+End of 5.0 tests
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index e81d46c9199..0185394cdad 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -874,6 +874,30 @@ num (select num + 2 FROM t1 LIMIT 1)
SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
ERROR 42S22: Unknown column 'num' in 'on clause'
DROP TABLE t1;
+CREATE TABLE bug25126 (
+val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
+);
+UPDATE bug25126 SET MissingCol = MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'field list'
+UPDATE bug25126 SET val = val ORDER BY MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET val = val ORDER BY val;
+UPDATE bug25126 SET val = 1 ORDER BY val;
+UPDATE bug25126 SET val = 1 ORDER BY MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
+ERROR 42S22: Unknown column 'MissingCol' in 'order clause'
+DROP TABLE bug25126;
CREATE TABLE t1 (a int);
SELECT p.a AS val, q.a AS val1 FROM t1 p, t1 q ORDER BY val > 1;
val val1
diff --git a/mysql-test/r/outfile.result b/mysql-test/r/outfile.result
index 040dff576f8..023c4ea205f 100644
--- a/mysql-test/r/outfile.result
+++ b/mysql-test/r/outfile.result
Binary files differ
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index d2b022a93fb..d77745176f7 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -622,7 +622,7 @@ word
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
-load data infile 'TEST_DIR/std_data/words.dat' into table t1;
+load data infile 'MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 702ac39cb95..f50f4859d48 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -3728,6 +3728,34 @@ WHERE ID_better=1 AND ID1_with_null IS NULL AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx1,idx2 idx2 4 const 1 Using where
DROP TABLE t1;
+CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
+INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
+INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
+INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1
+1 SIMPLE t1 range ts ts 4 NULL 1 Using where
+Warnings:
+Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+a ts a dt1 dt2
+30 2006-01-03 23:00:00 30 2006-01-01 00:00:00 2999-12-31 00:00:00
+Warnings:
+Warning 1292 Incorrect datetime value: '2999-12-31 00:00:00' for column 'ts' at row 1
+DROP TABLE t1,t2;
create table t1 (a bigint unsigned);
insert into t1 values
(if(1, 9223372036854775808, 1)),
diff --git a/mysql-test/r/sp-ucs2.result b/mysql-test/r/sp-ucs2.result
new file mode 100644
index 00000000000..ce6be5b0a65
--- /dev/null
+++ b/mysql-test/r/sp-ucs2.result
@@ -0,0 +1,14 @@
+drop function if exists bug17615|
+create table t3 (a varchar(256) unicode)|
+create function bug17615() returns varchar(256) unicode
+begin
+declare tmp_res varchar(256) unicode;
+set tmp_res= 'foo string';
+return tmp_res;
+end|
+insert into t3 values(bug17615())|
+select * from t3|
+a
+foo string
+drop function bug17615|
+drop table t3|
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 8e3c057cc62..62fd74adf91 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -4697,20 +4697,6 @@ Handler
Inner
drop procedure bug15011|
drop table t3|
-drop function if exists bug17615|
-create table t3 (a varchar(256) unicode)|
-create function bug17615() returns varchar(256) unicode
-begin
-declare tmp_res varchar(256) unicode;
-set tmp_res= 'foo string';
-return tmp_res;
-end|
-insert into t3 values(bug17615())|
-select * from t3|
-a
-foo string
-drop function bug17615|
-drop table t3|
drop procedure if exists bug17476|
create table t3 ( d date )|
insert into t3 values
diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result
index 73b67a2241e..95ba9bb6f25 100644
--- a/mysql-test/r/type_blob.result
+++ b/mysql-test/r/type_blob.result
@@ -506,26 +506,26 @@ create table t1 (id integer auto_increment unique,imagem LONGBLOB not null defau
Warnings:
Warning 1101 BLOB/TEXT column 'imagem' can't have a default value
insert into t1 (id) values (1);
-select
-charset(load_file('../../std_data/words.dat')),
-collation(load_file('../../std_data/words.dat')),
-coercibility(load_file('../../std_data/words.dat'));
-charset(load_file('../../std_data/words.dat')) collation(load_file('../../std_data/words.dat')) coercibility(load_file('../../std_data/words.dat'))
+select
+charset(load_file('../std_data_ln/words.dat')),
+collation(load_file('../std_data_ln/words.dat')),
+coercibility(load_file('../std_data_ln/words.dat'));
+charset(load_file('../std_data_ln/words.dat')) collation(load_file('../std_data_ln/words.dat')) coercibility(load_file('../std_data_ln/words.dat'))
binary binary 4
-explain extended select
-charset(load_file('../../std_data/words.dat')),
-collation(load_file('../../std_data/words.dat')),
-coercibility(load_file('../../std_data/words.dat'));
+explain extended select
+charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')),
+collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat')),
+coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'));
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 charset(load_file(_latin1'../../std_data/words.dat')) AS `charset(load_file('../../std_data/words.dat'))`,collation(load_file(_latin1'../../std_data/words.dat')) AS `collation(load_file('../../std_data/words.dat'))`,coercibility(load_file(_latin1'../../std_data/words.dat')) AS `coercibility(load_file('../../std_data/words.dat'))`
-update t1 set imagem=load_file('../../std_data/words.dat') where id=1;
+Note 1003 select charset(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `charset(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,collation(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `collation(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`,coercibility(load_file(_latin1'MYSQLTEST_VARDIR/std_data_ln/words.dat')) AS `coercibility(load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat'))`
+update t1 set imagem=load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
if(imagem is null, "ERROR", "OK") length(imagem)
OK 581
drop table t1;
-create table t1 select load_file('../../std_data/words.dat') l;
+create table t1 select load_file('MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
show full fields from t1;
Field Type Collation Null Key Default Extra Privileges Comment
l longblob NULL YES NULL #
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 4b7dbb3dbe9..9e2bc52657a 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/r/update.result
@@ -377,3 +377,60 @@ create table t1(f1 int, `*f2` int);
insert into t1 values (1,1);
update t1 set `*f2`=1;
drop table t1;
+CREATE TABLE t1 (
+request_id int unsigned NOT NULL auto_increment,
+user_id varchar(12) default NULL,
+time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
+ip_address varchar(15) default NULL,
+PRIMARY KEY (request_id),
+KEY user_id_2 (user_id,time_stamp)
+);
+INSERT INTO t1 (user_id) VALUES ('user1');
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+flush status;
+SELECT user_id FROM t1 WHERE request_id=9999999999999;
+user_id
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 1
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
+user_id
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 2
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 7
+UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 3
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 14
+UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
+show status like '%Handler_read%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 3
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 21
+DROP TABLE t1;
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 7185a70689a..50b41e1352f 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -2543,7 +2543,7 @@ create table t1(f1 int, f2 int);
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
.f1 and ta.f2=tb.f2;
insert into t1 values(1,1),(2,2);
-create view v2 as select * from v1 where a > 1 with check option;
+create view v2 as select * from v1 where a > 1 with local check option;
select * from v2;
a b
2 2
@@ -3034,4 +3034,105 @@ SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd`
DROP VIEW v1;
+CREATE TABLE t1 (mydate DATETIME);
+INSERT INTO t1 VALUES
+('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
+CREATE VIEW v1 AS SELECT mydate from t1;
+SELECT * FROM t1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
+mydate
+2007-01-01 00:00:00
+2007-01-02 00:00:00
+2007-01-30 00:00:00
+2007-01-31 00:00:00
+SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
+mydate
+2007-01-01 00:00:00
+2007-01-02 00:00:00
+2007-01-30 00:00:00
+2007-01-31 00:00:00
+DROP VIEW v1;
+DROP TABLE t1;
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+CREATE VIEW v1 AS
+SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
+SELECT * FROM v1;
+b
+1
+2
+UPDATE v1 SET b=3;
+ERROR HY000: CHECK OPTION failed 'test.v1'
+SELECT * FROM v1;
+b
+1
+2
+SELECT * FROM t1;
+a
+1
+2
+SELECT * FROM t2;
+b
+1
+2
+DROP VIEW v1;
+DROP TABLE t1,t2;
+create table t1(f1 int, f2 int);
+insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
+select * from t1;
+f1 f2
+1 2
+1 3
+1 1
+2 3
+2 1
+2 2
+create view v1 as select * from t1 order by f2;
+select * from v1;
+f1 f2
+1 1
+2 1
+1 2
+2 2
+1 3
+2 3
+explain extended select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+Warnings:
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order by `test`.`t1`.`f2`
+select * from v1 order by f1;
+f1 f2
+1 1
+1 2
+1 3
+2 1
+2 2
+2 3
+explain extended select * from v1 order by f1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort
+Warnings:
+Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t1`.`f2` AS `f2` from `test`.`t1` order by `test`.`t1`.`f1`,`test`.`t1`.`f2`
+drop view v1;
+drop table t1;
+CREATE TABLE t1 (
+id int(11) NOT NULL PRIMARY KEY,
+country varchar(32),
+code int(11) default NULL
+);
+INSERT INTO t1 VALUES
+(1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT code, COUNT(DISTINCT country) FROM t1 GROUP BY code ORDER BY MAX(id);
+code COUNT(DISTINCT country)
+200 1
+100 2
+SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
+code COUNT(DISTINCT country)
+200 1
+100 2
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.0 tests.
diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test
index 688d06c4dde..440ce02af9e 100644
--- a/mysql-test/t/ctype_cp932.test
+++ b/mysql-test/t/ctype_cp932.test
@@ -413,3 +413,17 @@ select * from t1;
insert into t1 values ('abc');
select * from t1;
drop table t1;
+
+#
+# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\'
+#
+
+# new command \C or charset
+--exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
+--exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
+
+# its usage to switch internally in mysql to requested charset
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
+--exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
+--exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
+--exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"
diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt
index a0b5b061860..84d2a52b639 100644
--- a/mysql-test/t/ctype_ucs2_def-master.opt
+++ b/mysql-test/t/ctype_ucs2_def-master.opt
@@ -1 +1 @@
---default-collation=ucs2_unicode_ci --default-character-set=ucs2
+--default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1
diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test
index 00f636d79dc..e435d1fb07d 100644
--- a/mysql-test/t/ctype_ucs2_def.test
+++ b/mysql-test/t/ctype_ucs2_def.test
@@ -1,3 +1,5 @@
+-- source include/have_ucs2.inc
+
#
# MySQL Bug#15276: MySQL ignores collation-server
#
diff --git a/mysql-test/t/default.test b/mysql-test/t/default.test
index 225ddbc3ee2..14aa4b02cfe 100644
--- a/mysql-test/t/default.test
+++ b/mysql-test/t/default.test
@@ -137,6 +137,13 @@ insert into bug20691 values (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAUL
select * from bug20691 order by x asc;
drop table bug20691;
-###
+create table t1 (id int not null);
+insert into t1 values(default);
+
+create view v1 (c) as select id from t1;
+insert into t1 values(default);
+drop view v1;
+drop table t1;
+
--echo End of 5.0 tests.
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 95fdf642b94..ff9fcad1fcf 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -428,3 +428,12 @@ drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
drop table t1;
+
+#
+# Bug #20691 (DEFAULT over NOT NULL field)
+#
+create table t1 (g geometry not null);
+--error ER_CANT_CREATE_GEOMETRY_OBJECT
+insert into t1 values(default);
+drop table t1;
+
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index d1dd485e21c..f8922317eb3 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -999,4 +999,28 @@ where table_schema = 'test' and table_name not in
where table_schema = 'test' and column_name = 'f3');
drop table t1,t2;
+
+#
+# Bug#24630 Subselect query crashes mysqld
+#
+select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
+(select cast(table_name as char) from information_schema.tables
+ order by table_name limit 1) limit 1;
+
+select t.table_name, group_concat(t.table_schema, '.', t.table_name),
+ count(*) as num1
+from information_schema.tables t
+inner join information_schema.columns c1
+on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
+where t.table_schema = 'information_schema' and
+ c1.ordinal_position =
+ (select isnull(c2.column_type) -
+ isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
+ count(*) as num
+ from information_schema.columns c2 where
+ c2.table_schema='information_schema' and
+ (c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
+ group by c2.column_type order by num limit 1)
+group by t.table_name order by num1, t.table_name;
+
# End of 5.0 tests.
diff --git a/mysql-test/t/innodb-ucs2.test b/mysql-test/t/innodb-ucs2.test
new file mode 100644
index 00000000000..6647a9d0845
--- /dev/null
+++ b/mysql-test/t/innodb-ucs2.test
@@ -0,0 +1,226 @@
+-- source include/have_innodb.inc
+-- source include/have_ucs2.inc
+
+#
+# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
+#
+
+create table t1 (
+ a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+ a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+ a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
+insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
+insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+
+create table t1 (
+ a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set utf8 engine = innodb;
+create table t2 (
+ a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
+) character set ucs2 engine = innodb;
+insert into t1 values (1,'abcdefg','abcdefg','one');
+insert into t1 values (2,'ijkilmn','ijkilmn','two');
+insert into t1 values (3,'qrstuvw','qrstuvw','three');
+insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
+insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
+insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
+insert into t2 values (1,'abcdefg','abcdefg','one');
+insert into t2 values (2,'ijkilmn','ijkilmn','two');
+insert into t2 values (3,'qrstuvw','qrstuvw','three');
+insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
+insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
+insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
+insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
+insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
+insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
+insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
+update t1 set filler = 'boo' where a = 1;
+update t2 set filler ='email' where a = 4;
+select a,hex(b),hex(c),filler from t1 order by filler;
+select a,hex(b),hex(c),filler from t2 order by filler;
+drop table t1;
+drop table t2;
+commit;
+
+#
+# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
+#
+CREATE TABLE t1 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind enum('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind set('0','1','2') NOT NULL default '0',
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+
+INSERT INTO t1 VALUES ('1', ''),('2', '');
+INSERT INTO t2 VALUES ('1', ''),('2', '');
+SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
+SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
+drop table t1,t2;
+
+CREATE TABLE t1 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE t2 (
+ ind bit not null,
+ string1 varchar(250) NOT NULL,
+ PRIMARY KEY (ind)
+) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
+insert into t1 values(0,''),(1,'');
+insert into t2 values(0,''),(1,'');
+select hex(ind),hex(string1) from t1 order by string1;
+select hex(ind),hex(string1) from t2 order by string1;
+drop table t1,t2;
+
+# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
+
+create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set utf8 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+create table t2 (
+ a int, b char(10), filler char(10), primary key(a, b(2))
+) character set ucs2 engine = innodb;
+
+insert into t2 values (1,'abcdefg','one');
+insert into t2 values (2,'ijkilmn','two');
+insert into t2 values (3, 'qrstuvw','three');
+update t2 set a=5, filler='booo' where a=1;
+drop table t2;
+
+create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
+insert into t1 values(1,'abcdefg'),(2,'defghijk');
+insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
+insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
+select a,hex(b) from t1 order by b;
+update t1 set b = 'three' where a = 6;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 20f07ccdde0..aa25677bd99 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1636,139 +1636,6 @@ connection default;
disconnect a;
disconnect b;
-#
-# BUG 14056 Column prefix index on UTF-8 primary key column causes: Can't find record..
-#
-
-create table t1 (
- a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
- a int, b char(10), c char(10), filler char(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-create table t1 (
- a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
- a int, b varchar(10), c varchar(10), filler varchar(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-create table t1 (
- a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
- a int, b text(10), c text(10), filler text(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xe880bde880bd,_utf8 0xe880bde880bd,'six');
-insert into t1 values (4,_utf8 0xe880bdD0B1e880bd,_utf8 0xe880bdD0B1e880bd,'seven');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05630563,_ucs2 0x05630563,'eleven');
-insert into t2 values (4,_ucs2 0x0563001fc0563,_ucs2 0x0563001fc0563,'point');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-
-create table t1 (
- a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set utf8 engine = innodb;
-create table t2 (
- a int, b blob(10), c blob(10), filler blob(10), primary key(a, b(2)), unique key (a, c(2))
-) character set ucs2 engine = innodb;
-insert into t1 values (1,'abcdefg','abcdefg','one');
-insert into t1 values (2,'ijkilmn','ijkilmn','two');
-insert into t1 values (3,'qrstuvw','qrstuvw','three');
-insert into t1 values (4,_utf8 0xe880bd,_utf8 0xe880bd,'four');
-insert into t1 values (4,_utf8 0x5b,_utf8 0x5b,'five');
-insert into t1 values (4,_utf8 0xD0B1,_utf8 0xD0B1,'eight');
-insert into t2 values (1,'abcdefg','abcdefg','one');
-insert into t2 values (2,'ijkilmn','ijkilmn','two');
-insert into t2 values (3,'qrstuvw','qrstuvw','three');
-insert into t2 values (4,_ucs2 0x00e400,_ucs2 0x00e400,'four');
-insert into t2 values (4,_ucs2 0x00640065,_ucs2 0x00640065,'five');
-insert into t2 values (4,_ucs2 0x00e400e50068,_ucs2 0x00e400e50068,'six');
-insert into t2 values (4,_ucs2 0x01fc,_ucs2 0x01fc,'seven');
-insert into t2 values (4,_ucs2 0x0120,_ucs2 0x0120,'eight');
-insert into t2 values (4,_ucs2 0x0563,_ucs2 0x0563,'ten');
-insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
-update t1 set filler = 'boo' where a = 1;
-update t2 set filler ='email' where a = 4;
-select a,hex(b),hex(c),filler from t1 order by filler;
-select a,hex(b),hex(c),filler from t2 order by filler;
-drop table t1;
-drop table t2;
-commit;
-
# tests for bugs #9802 and #13778
# test that FKs between invalid types are not accepted
@@ -1949,95 +1816,6 @@ select a,hex(s1) from t1;
select hex(s1) from t2;
drop table t2,t1;
-#
-# Test cases for bug #15308 Problem of Order with Enum Column in Primary Key
-#
-CREATE TABLE t1 (
- ind enum('0','1','2') NOT NULL default '0',
- string1 varchar(250) NOT NULL,
- PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
- ind enum('0','1','2') NOT NULL default '0',
- string1 varchar(250) NOT NULL,
- PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-drop table t1,t2;
-
-CREATE TABLE t1 (
- ind set('0','1','2') NOT NULL default '0',
- string1 varchar(250) NOT NULL,
- PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
- ind set('0','1','2') NOT NULL default '0',
- string1 varchar(250) NOT NULL,
- PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-
-INSERT INTO t1 VALUES ('1', ''),('2', '');
-INSERT INTO t2 VALUES ('1', ''),('2', '');
-SELECT hex(ind),hex(string1) FROM t1 ORDER BY string1;
-SELECT hex(ind),hex(string1) FROM t2 ORDER BY string1;
-drop table t1,t2;
-
-CREATE TABLE t1 (
- ind bit not null,
- string1 varchar(250) NOT NULL,
- PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-CREATE TABLE t2 (
- ind bit not null,
- string1 varchar(250) NOT NULL,
- PRIMARY KEY (ind)
-) ENGINE=InnoDB DEFAULT CHARSET=ucs2;
-insert into t1 values(0,''),(1,'');
-insert into t2 values(0,''),(1,'');
-select hex(ind),hex(string1) from t1 order by string1;
-select hex(ind),hex(string1) from t2 order by string1;
-drop table t1,t2;
-
-# tests for bug #14056 Column prefix index on UTF-8 primary key column causes 'Can't find record..'
-
-create table t2 (
- a int, b char(10), filler char(10), primary key(a, b(2))
-) character set utf8 engine = innodb;
-
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-create table t2 (
- a int, b char(10), filler char(10), primary key(a, b(2))
-) character set ucs2 engine = innodb;
-
-insert into t2 values (1,'abcdefg','one');
-insert into t2 values (2,'ijkilmn','two');
-insert into t2 values (3, 'qrstuvw','three');
-update t2 set a=5, filler='booo' where a=1;
-drop table t2;
-
-create table t1(a int not null, b char(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-update t1 set b = 'three' where a = 6;
-drop table t1;
-create table t1(a int not null, b text(110),primary key(a,b(100))) engine=innodb default charset=utf8;
-insert into t1 values(1,'abcdefg'),(2,'defghijk');
-insert into t1 values(6,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1);
-insert into t1 values(7,_utf8 0xD0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B1D0B2);
-select a,hex(b) from t1 order by b;
-update t1 set b = 'three' where a = 6;
-drop table t1;
-
# Ensure that <tablename>_ibfk_0 is not mistreated as a
# generated foreign key identifier. (Bug #16387)
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 45a2ede091b..c351891d205 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -384,6 +384,32 @@ EXPLAIN SELECT SQL_BIG_RESULT b, SUM(c) FROM t1 GROUP BY b;
DROP TABLE t1;
+#
+# Bug#26159: crash for a loose scan of a table that has been emptied
+#
+
+CREATE TABLE t1 (
+ id int NOT NULL,
+ name varchar(20) NOT NULL,
+ dept varchar(20) NOT NULL,
+ age tinyint(3) unsigned NOT NULL,
+ PRIMARY KEY (id),
+ INDEX (name,dept)
+) ENGINE=InnoDB;
+INSERT INTO t1(id, dept, age, name) VALUES
+ (3987, 'cs1', 10, 'rs1'), (3988, 'cs2', 20, 'rs1'), (3995, 'cs3', 10, 'rs2'),
+ (3996, 'cs4', 20, 'rs2'), (4003, 'cs5', 10, 'rs3'), (4004, 'cs6', 20, 'rs3'),
+ (4011, 'cs7', 10, 'rs4'), (4012, 'cs8', 20, 'rs4'), (4019, 'cs9', 10, 'rs5'),
+ (4020, 'cs10', 20, 'rs5'),(4027, 'cs11', 10, 'rs6'),(4028, 'cs12', 20, 'rs6');
+
+EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+DELETE FROM t1;
+EXPLAIN SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+SELECT DISTINCT t1.name, t1.dept FROM t1 WHERE t1.name='rs5';
+
+DROP TABLE t1;
+
--source include/innodb_rollback_on_timeout.inc
--echo End of 5.0 tests
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index 404d67390ab..5c60fc8e1f0 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -265,4 +265,30 @@ INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
DROP DATABASE bug21774_1;
DROP DATABASE bug21774_2;
+USE test;
+#
+# Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were
+# updated.
+#
+create table t1(f1 int primary key, f2 int);
+--enable_info
+insert into t1 values (1,1);
+insert into t1 values (1,1) on duplicate key update f2=1;
+insert into t1 values (1,1) on duplicate key update f2=2;
+--disable_info
+select * from t1;
+drop table t1;
+
+#
+# Bug#23170: LAST_INSERT_ID isn't reset to 0 in INSERT .. SELECT if no rows
+# were inserted.
+#
+create table t1(f1 int primary key auto_increment, f2 int unique);
+insert into t1(f2) values(1);
+select @@identity;
+insert ignore t1(f2) values(1);
+select @@identity;
+insert ignore t1(f2) select 1;
+select @@identity;
+drop table t1;
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index 20462f2ca3f..a0620e144c2 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -802,3 +802,26 @@ SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1 OR 2=2);
SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.b WHERE (1=1 OR 1=0);
DROP TABLE t1,t2;
+
+#
+# Bug 26017: LEFT OUTER JOIN over two constant tables and
+# a case-insensitive comparison predicate field=const
+#
+
+CREATE TABLE t1 (
+ f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
+ f2 varchar(16) collate latin1_swedish_ci
+);
+CREATE TABLE t2 (
+ f1 varchar(16) collate latin1_swedish_ci PRIMARY KEY,
+ f3 varchar(16) collate latin1_swedish_ci
+);
+
+INSERT INTO t1 VALUES ('bla','blah');
+INSERT INTO t2 VALUES ('bla','sheep');
+
+SELECT * FROM t1 JOIN t2 USING(f1) WHERE f1='Bla';
+SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='bla';
+SELECT * FROM t1 LEFT JOIN t2 USING(f1) WHERE f1='Bla';
+
+DROP TABLE t1,t2;
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 27c8005ca0c..0dc91c36a09 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -110,6 +110,29 @@ truncate table t1;
load data infile '../std_data_ln/rpl_loaddata.dat' into table t1 (@dummy,@n) set a= @n, c= (select str from t2 where num=@n);
select * from t1;
+#
+# Bug#18628 mysql-test-run: security problem
+#
+# It should not be possible to load from a file outside of vardir
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show variables like "secure_file_pri%";
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+select @@secure_file_priv;
+--error 1238
+set @@secure_file_priv= 0;
+
+# Test "load data"
+truncate table t1;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--error 1290
+eval load data infile '$MYSQL_TEST_DIR/Makefile' into table t1;
+select * from t1;
+
+# Test "load_file" returns NULL
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval select load_file("$MYSQL_TEST_DIR/Makefile");
+
# cleanup
drop table t1, t2;
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 829be665e09..74310fd45aa 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -44,20 +44,6 @@ unlock tables;
drop table t1;
#
-# BUG#16217 - MySQL client misinterpretes multi-byte char as escape `\'
-#
-
-# new command \C or charset
---exec $MYSQL --default-character-set=utf8 test -e "\C cp932 \g"
---exec $MYSQL --default-character-set=cp932 test -e "charset utf8;"
-
-# its usage to switch internally in mysql to requested charset
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'; create table t1 (c_cp932 TEXT CHARACTER SET cp932); insert into t1 values('ƒ\'); select * from t1; drop table t1;"
---exec $MYSQL --default-character-set=utf8 test -e "charset cp932; select 'ƒ\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*charset cp932 */; set character_set_client= cp932; select 'ƒ\'"
---exec $MYSQL --default-character-set=utf8 test -e "/*!\C cp932 */; set character_set_client= cp932; select 'ƒ\'"
-
-#
# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
#
--exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
diff --git a/mysql-test/t/mysqlbinlog-cp932-master.opt b/mysql-test/t/mysqlbinlog-cp932-master.opt
new file mode 100644
index 00000000000..bb0cda4519a
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog-cp932-master.opt
@@ -0,0 +1 @@
+--max-binlog-size=8192
diff --git a/mysql-test/t/mysqlbinlog-cp932.test b/mysql-test/t/mysqlbinlog-cp932.test
new file mode 100644
index 00000000000..0e0a4e2bfae
--- /dev/null
+++ b/mysql-test/t/mysqlbinlog-cp932.test
@@ -0,0 +1,19 @@
+-- source include/have_cp932.inc
+
+# Bug#16217 (mysql client did not know how not switch its internal charset)
+flush logs;
+create table t3 (f text character set utf8);
+create table t4 (f text character set cp932);
+--exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')"
+--exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
+flush logs;
+rename table t3 to t03, t4 to t04;
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000002 | $MYSQL --default-character-set=utf8
+# original and recovered data must be equal
+select HEX(f) from t03;
+select HEX(f) from t3;
+select HEX(f) from t04;
+select HEX(f) from t4;
+
+drop table t3, t4, t03, t04;
+--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index b2bda247cd7..05027b6fc40 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -107,21 +107,6 @@ select "--- reading stdin --" as "";
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001
-# Bug#16217 (mysql client did not know how not switch its internal charset)
-flush logs;
-create table t3 (f text character set utf8);
-create table t4 (f text character set cp932);
---exec $MYSQL --default-character-set=utf8 test -e "insert into t3 values(_utf8'ソ')"
---exec $MYSQL --default-character-set=cp932 test -e "insert into t4 values(_cp932'ƒ\');"
-flush logs;
-rename table t3 to t03, t4 to t04;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL --default-character-set=utf8
-# original and recovered data must be equal
-select HEX(f) from t03;
-select HEX(f) from t3;
-select HEX(f) from t04;
-select HEX(f) from t4;
-
#
#BUG#14157: utf8 encoding in binlog without set character_set_client
#
@@ -131,7 +116,7 @@ flush logs;
# resulted binlog, parly consisting of multi-byte utf8 chars,
# must be digestable for both client and server. In 4.1 the client
# should use default-character-set same as the server.
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000006 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000004 | $MYSQL
select * from t5 /* must be (1),(1) */;
#
@@ -150,7 +135,7 @@ insert into t5 values (3, date_format('2001-01-01','%W'));
select * from t5 order by c1;
flush logs;
drop table t5;
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000005 | $MYSQL
select * from t5 order by c1;
#
# Bug#20396 Bin Log does not get DELIMETER cmd - Recover StoredProc fails
@@ -171,12 +156,12 @@ call p1();
drop procedure p1;
--error 1305
call p1();
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000009 | $MYSQL
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007
+--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000007 | $MYSQL
call p1();
drop procedure p1;
# clean up
-drop table t1, t2, t03, t04, t3, t4, t5;
+drop table t1, t2, t5;
-# End of 5.0 tests
+--echo End of 5.0 tests
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 012b38ff8b7..5533f273b0d 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -589,6 +589,36 @@ SELECT a.a + 1 AS num FROM t1 a JOIN t1 b ON num = b.a;
DROP TABLE t1;
#
+# Bug#25126: Reference to non-existant column in UPDATE...ORDER BY...
+# crashes server
+#
+CREATE TABLE bug25126 (
+ val int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
+);
+--error 1054
+UPDATE bug25126 SET MissingCol = MissingCol;
+--error 1054
+UPDATE bug25126 SET val = val ORDER BY MissingCol;
+UPDATE bug25126 SET val = val ORDER BY val;
+UPDATE bug25126 SET val = 1 ORDER BY val;
+--error 1054
+UPDATE bug25126 SET val = 1 ORDER BY MissingCol;
+--error 1054
+UPDATE bug25126 SET val = 1 ORDER BY val, MissingCol;
+--error 1054
+UPDATE bug25126 SET val = MissingCol ORDER BY MissingCol;
+--error 1054
+UPDATE bug25126 SET MissingCol = 1 ORDER BY val, MissingCol;
+--error 1054
+UPDATE bug25126 SET MissingCol = 1 ORDER BY MissingCol;
+--error 1054
+UPDATE bug25126 SET MissingCol = val ORDER BY MissingCol;
+--error 1054
+UPDATE bug25126 SET MissingCol = MissingCol ORDER BY MissingCol;
+DROP TABLE bug25126;
+
+
+#
# Bug #25427: crash when order by expression contains a name
# that cannot be resolved unambiguously
#
@@ -603,7 +633,6 @@ SELECT p.a AS val, q.a AS val FROM t1 p, t1 q ORDER BY val > 1;
DROP TABLE t1;
-# End of 4.1 tests
create table t1 (a int not null, b int not null, c int not null);
insert t1 values (1,1,1),(1,1,2),(1,2,1);
select a, b from t1 group by a, b order by sum(c);
diff --git a/mysql-test/t/outfile.test b/mysql-test/t/outfile.test
index c48e6c9730d..7c90fd32909 100644
--- a/mysql-test/t/outfile.test
+++ b/mysql-test/t/outfile.test
@@ -84,3 +84,15 @@ FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
FROM schemata LIMIT 0, 5;
enable_query_log;
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
+use test;
+
+#
+# Bug#18628 mysql-test-run: security problem
+#
+# It should not be possible to write to a file outside of vardir
+create table t1(a int);
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+--error 1290
+eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1;
+drop table t1;
+
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index f6e480282ff..427334805ce 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -405,8 +405,8 @@ select * from t1 where id=2;
create table t1 (word char(20) not null);
select * from t1;
show status like "Qcache_queries_in_cache";
---replace_result $MYSQL_TEST_DIR TEST_DIR
-eval load data infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval load data infile '$MYSQLTEST_VARDIR/std_data_ln/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
select count(*) from t1;
drop table t1;
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 92b831dd79b..c4737814137 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3207,6 +3207,29 @@ EXPLAIN SELECT * FROM t1
(ID2_with_null=1 OR ID2_with_null=2);
DROP TABLE t1;
+
+#
+# Bug #22344: InnoDB keys act strange on datetime vs timestamp comparison
+#
+CREATE TABLE t1 (a INT, ts TIMESTAMP, KEY ts(ts));
+INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
+ANALYZE TABLE t1;
+
+CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
+INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
+INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
+ANALYZE TABLE t2;
+
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+ AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+ AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+
+SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
+ AND t1.ts BETWEEN t2.dt1 AND t2.dt2
+ AND t1.ts BETWEEN "2006-01-01" AND "2006-12-31";
+
+DROP TABLE t1,t2;
#
# Bug #22026: Warning when using IF statement and large unsigned bigint
#
diff --git a/mysql-test/t/sp-ucs2.test b/mysql-test/t/sp-ucs2.test
new file mode 100644
index 00000000000..7dd88b04871
--- /dev/null
+++ b/mysql-test/t/sp-ucs2.test
@@ -0,0 +1,28 @@
+-- source include/have_ucs2.inc
+
+delimiter |;
+
+#
+# BUG#17615: problem with character set
+#
+--disable_warnings
+drop function if exists bug17615|
+--enable_warnings
+
+create table t3 (a varchar(256) unicode)|
+
+create function bug17615() returns varchar(256) unicode
+begin
+ declare tmp_res varchar(256) unicode;
+ set tmp_res= 'foo string';
+ return tmp_res;
+end|
+
+insert into t3 values(bug17615())|
+select * from t3|
+
+drop function bug17615|
+drop table t3|
+
+
+delimiter ;|
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index cfa4937e050..4eaaf757598 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -11,6 +11,8 @@
# Tests that uses 'goto' to into sp-goto.test (currently disabled)
# Tests that destroys system tables (e.g. mysql.proc) for error testing
# go to sp-destruct.
+# Tests that require multibyte character sets, which are not always available,
+# go into separate files (e.g. sp-ucs2.test)
use test;
@@ -5526,29 +5528,6 @@ drop table t3|
#
-# BUG#17615: problem with character set
-#
---disable_warnings
-drop function if exists bug17615|
---enable_warnings
-
-create table t3 (a varchar(256) unicode)|
-
-create function bug17615() returns varchar(256) unicode
-begin
- declare tmp_res varchar(256) unicode;
- set tmp_res= 'foo string';
- return tmp_res;
-end|
-
-insert into t3 values(bug17615())|
-select * from t3|
-
-drop function bug17615|
-drop table t3|
-
-
-#
# BUG#17476: Stored procedure not returning data when it is called first
# time per connection
#
diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test
index 6d79dcc863b..ba9f374a24c 100644
--- a/mysql-test/t/type_blob.test
+++ b/mysql-test/t/type_blob.test
@@ -307,22 +307,21 @@ drop table t1;
create table t1 (id integer auto_increment unique,imagem LONGBLOB not null default '');
insert into t1 (id) values (1);
# We have to clean up the path in the results for safe comparison
---replace_result $MYSQL_TEST_DIR ../..
-eval select
- charset(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
- collation(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
- coercibility(load_file('$MYSQL_TEST_DIR/std_data/words.dat'));
---replace_result $MYSQL_TEST_DIR ../..
-eval explain extended select
- charset(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
- collation(load_file('$MYSQL_TEST_DIR/std_data/words.dat')),
- coercibility(load_file('$MYSQL_TEST_DIR/std_data/words.dat'));
---replace_result $MYSQL_TEST_DIR ../..
-eval update t1 set imagem=load_file('$MYSQL_TEST_DIR/std_data/words.dat') where id=1;
+eval select
+ charset(load_file('../std_data_ln/words.dat')),
+ collation(load_file('../std_data_ln/words.dat')),
+ coercibility(load_file('../std_data_ln/words.dat'));
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval explain extended select
+ charset(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')),
+ collation(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat')),
+ coercibility(load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat'));
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval update t1 set imagem=load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') where id=1;
select if(imagem is null, "ERROR", "OK"),length(imagem) from t1 where id = 1;
drop table t1;
---replace_result $MYSQL_TEST_DIR ../..
-eval create table t1 select load_file('$MYSQL_TEST_DIR/std_data/words.dat') l;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval create table t1 select load_file('$MYSQLTEST_VARDIR/std_data_ln/words.dat') l;
# We mask out the Privileges column because it differs for embedded server
--replace_column 8 #
show full fields from t1;
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 5a49de248b1..3ce7ef72670 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -307,3 +307,38 @@ insert into t1 values (1,1);
update t1 set `*f2`=1;
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #24035: performance degradation with condition int_field=big_decimal
+#
+
+CREATE TABLE t1 (
+ request_id int unsigned NOT NULL auto_increment,
+ user_id varchar(12) default NULL,
+ time_stamp datetime NOT NULL default '0000-00-00 00:00:00',
+ ip_address varchar(15) default NULL,
+ PRIMARY KEY (request_id),
+ KEY user_id_2 (user_id,time_stamp)
+);
+
+INSERT INTO t1 (user_id) VALUES ('user1');
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+INSERT INTO t1(user_id) SELECT user_id FROM t1;
+
+flush status;
+SELECT user_id FROM t1 WHERE request_id=9999999999999;
+show status like '%Handler_read%';
+SELECT user_id FROM t1 WHERE request_id=999999999999999999999999999999;
+show status like '%Handler_read%';
+UPDATE t1 SET user_id=null WHERE request_id=9999999999999;
+show status like '%Handler_read%';
+UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999;
+show status like '%Handler_read%';
+
+DROP TABLE t1;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 47a5a54007b..33e381af476 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -2385,7 +2385,7 @@ create table t1(f1 int, f2 int);
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
.f1 and ta.f2=tb.f2;
insert into t1 values(1,1),(2,2);
-create view v2 as select * from v1 where a > 1 with check option;
+create view v2 as select * from v1 where a > 1 with local check option;
select * from v2;
update v2 set b=3 where a=2;
select * from v2;
@@ -2986,4 +2986,76 @@ SHOW CREATE VIEW v1;
DROP VIEW v1;
+#
+# Bug #26124: BETWEEN over a view column of the DATETIME type
+#
+
+CREATE TABLE t1 (mydate DATETIME);
+INSERT INTO t1 VALUES
+ ('2007-01-01'), ('2007-01-02'), ('2007-01-30'), ('2007-01-31');
+
+CREATE VIEW v1 AS SELECT mydate from t1;
+
+SELECT * FROM t1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
+SELECT * FROM v1 WHERE mydate BETWEEN '2007-01-01' AND '2007-01-31';
+
+DROP VIEW v1;
+DROP TABLE t1;
+
+#
+# Bug #25931: update of a multi-table view with check option
+#
+
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1), (2);
+
+CREATE VIEW v1 AS
+ SELECT t2.b FROM t1,t2 WHERE t1.a = t2.b WITH CHECK OPTION;
+
+SELECT * FROM v1;
+--error 1369
+UPDATE v1 SET b=3;
+SELECT * FROM v1;
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+#
+# Bug#12122: Views with ORDER BY can't be resolved using MERGE algorithm.
+#
+create table t1(f1 int, f2 int);
+insert into t1 values(1,2),(1,3),(1,1),(2,3),(2,1),(2,2);
+select * from t1;
+create view v1 as select * from t1 order by f2;
+select * from v1;
+explain extended select * from v1;
+select * from v1 order by f1;
+explain extended select * from v1 order by f1;
+drop view v1;
+drop table t1;
+
+#
+# Bug#26209: queries with GROUP BY and ORDER BY using views
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL PRIMARY KEY,
+ country varchar(32),
+ code int(11) default NULL
+);
+INSERT INTO t1 VALUES
+ (1,'ITALY',100),(2,'ITALY',200),(3,'FRANCE',100), (4,'ITALY',100);
+
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT code, COUNT(DISTINCT country) FROM t1 GROUP BY code ORDER BY MAX(id);
+SELECT code, COUNT(DISTINCT country) FROM v1 GROUP BY code ORDER BY MAX(id);
+
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests.
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index b9da9d4817a..0422e0c6512 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -29,7 +29,7 @@
#define SCHED_POLICY SCHED_OTHER
#endif
-uint thd_lib_detected;
+uint thd_lib_detected= 0;
#ifndef my_pthread_setprio
void my_pthread_setprio(pthread_t thread_id,int prior)
diff --git a/sql/Makefile.am b/sql/Makefile.am
index 1ac8602ebdf..4f84023724f 100644
--- a/sql/Makefile.am
+++ b/sql/Makefile.am
@@ -163,7 +163,8 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
# this avoid the rebuild of the built files in a source dist
lex_hash.h: gen_lex_hash.cc lex.h
$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
- ./gen_lex_hash$(EXEEXT) > $@
+ ./gen_lex_hash$(EXEEXT) > $@-t
+ $(MV) $@-t $@
# For testing of udf_example.so
noinst_LTLIBRARIES= udf_example.la
diff --git a/sql/field.h b/sql/field.h
index 7f71fd2aec8..fe3c59c89f5 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -29,7 +29,7 @@
class Send_field;
class Protocol;
struct st_cache_field;
-void field_conv(Field *to,Field *from);
+int field_conv(Field *to,Field *from);
inline uint get_enum_pack_length(int elements)
{
@@ -1252,7 +1252,7 @@ public:
uint max_packed_col_length(uint max_length);
void free() { value.free(); }
inline void clear_temporary() { bzero((char*) &value,sizeof(value)); }
- friend void field_conv(Field *to,Field *from);
+ friend int field_conv(Field *to,Field *from);
uint size_of() const { return sizeof(*this); }
bool has_charset(void) const
{ return charset() == &my_charset_bin ? FALSE : TRUE; }
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index e5752708123..dbe58d804ad 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -679,7 +679,7 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
/* Simple quick field convert that is called on insert */
-void field_conv(Field *to,Field *from)
+int field_conv(Field *to,Field *from)
{
if (to->real_type() == from->real_type() &&
!(to->type() == FIELD_TYPE_BLOB && to->table->copy_blobs))
@@ -707,7 +707,7 @@ void field_conv(Field *to,Field *from)
if (to->ptr != from->ptr)
#endif
memcpy(to->ptr,from->ptr,to->pack_length());
- return;
+ return 0;
}
}
if (to->type() == FIELD_TYPE_BLOB)
@@ -723,8 +723,7 @@ void field_conv(Field *to,Field *from)
from->real_type() != MYSQL_TYPE_STRING &&
from->real_type() != MYSQL_TYPE_VARCHAR))
blob->value.copy();
- blob->store(blob->value.ptr(),blob->value.length(),from->charset());
- return;
+ return blob->store(blob->value.ptr(),blob->value.length(),from->charset());
}
if ((from->result_type() == STRING_RESULT &&
(to->result_type() == STRING_RESULT ||
@@ -741,15 +740,15 @@ void field_conv(Field *to,Field *from)
end with \0. Can be replaced with .ptr() when we have our own
string->double conversion.
*/
- to->store(result.c_ptr_quick(),result.length(),from->charset());
+ return to->store(result.c_ptr_quick(),result.length(),from->charset());
}
else if (from->result_type() == REAL_RESULT)
- to->store(from->val_real());
+ return to->store(from->val_real());
else if (from->result_type() == DECIMAL_RESULT)
{
my_decimal buff;
- to->store_decimal(from->val_decimal(&buff));
+ return to->store_decimal(from->val_decimal(&buff));
}
else
- to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
+ return to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG));
}
diff --git a/sql/item.cc b/sql/item.cc
index 9a55eb25e2c..050171b8fbe 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3724,7 +3724,18 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
use the field from the Item_field in the select list and leave
the Item_field instance in place.
*/
- set_field((*((Item_field**)res))->field);
+
+ Field *field= (*((Item_field**)res))->field;
+
+ if (field == NULL)
+ {
+ /* The column to which we link isn't valid. */
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), (*res)->name,
+ current_thd->where);
+ return(1);
+ }
+
+ set_field(field);
return 0;
}
else
@@ -4245,18 +4256,19 @@ void Item_field::save_org_in_field(Field *to)
int Item_field::save_in_field(Field *to, bool no_conversions)
{
+ int res;
if (result_field->is_null())
{
null_value=1;
- return set_field_to_null_with_conversions(to, no_conversions);
+ res= set_field_to_null_with_conversions(to, no_conversions);
}
else
{
to->set_notnull();
- field_conv(to,result_field);
+ res= field_conv(to,result_field);
null_value=0;
}
- return 0;
+ return res;
}
@@ -5276,18 +5288,7 @@ my_decimal *Item_ref::val_decimal(my_decimal *decimal_value)
int Item_ref::save_in_field(Field *to, bool no_conversions)
{
int res;
- if (result_field)
- {
- if (result_field->is_null())
- {
- null_value= 1;
- return set_field_to_null_with_conversions(to, no_conversions);
- }
- to->set_notnull();
- field_conv(to, result_field);
- null_value= 0;
- return 0;
- }
+ DBUG_ASSERT(!result_field);
res= (*ref)->save_in_field(to, no_conversions);
null_value= (*ref)->null_value;
return res;
@@ -5505,6 +5506,13 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
{
if (field_arg->flags & NO_DEFAULT_VALUE_FLAG)
{
+ if (field_arg->reset())
+ {
+ my_message(ER_CANT_CREATE_GEOMETRY_OBJECT,
+ ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0));
+ return -1;
+ }
+
if (context->error_processor == &view_error_processor)
{
TABLE_LIST *view= cached_table->top_table();
@@ -5523,7 +5531,6 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
ER(ER_NO_DEFAULT_FOR_FIELD),
field_arg->field_name);
}
- field_arg->set_default();
return 1;
}
field_arg->set_default();
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 7b69e2778ad..9ca010e7cf5 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1240,11 +1240,11 @@ void Item_func_between::fix_length_and_dec()
They are compared as integers, so for const item this time-consuming
conversion can be done only once, not for every single comparison
*/
- if (args[0]->type() == FIELD_ITEM &&
+ if (args[0]->real_item()->type() == FIELD_ITEM &&
thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
thd->lex->sql_command != SQLCOM_SHOW_CREATE)
{
- Field *field=((Item_field*) args[0])->field;
+ Field *field=((Item_field*) (args[0]->real_item()))->field;
if (field->can_be_compared_as_longlong())
{
/*
@@ -4089,11 +4089,9 @@ longlong Item_equal::val_int()
void Item_equal::fix_length_and_dec()
{
- Item *item= const_item ? const_item : get_first();
+ Item *item= get_first();
eval_item= cmp_item::get_comparator(item->result_type(),
item->collation.collation);
- if (item->result_type() == STRING_RESULT)
- eval_item->cmp_charset= cmp_collation.collation;
}
bool Item_equal::walk(Item_processor processor, byte *arg)
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index eb1f4dfdabd..d7db928e281 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1299,7 +1299,6 @@ class Item_equal: public Item_bool_func
Item *const_item; /* optional constant item equal to fields items */
cmp_item *eval_item;
bool cond_false;
- DTCollation cmp_collation;
public:
inline Item_equal()
: Item_bool_func(), const_item(0), eval_item(0), cond_false(0)
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 95cc32b5c8e..b402e733a44 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2780,6 +2780,11 @@ String *Item_load_file::val_str(String *str)
(void) fn_format(path, file_name->c_ptr(), mysql_real_data_home, "",
MY_RELATIVE_PATH | MY_UNPACK_FILENAME);
+ /* Read only allowed from within dir specified by secure_file_priv */
+ if (opt_secure_file_priv &&
+ strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
+ goto err;
+
if (!my_stat(path, &stat_info, MYF(0)))
goto err;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index b2a1923e19c..fb3ac00fd62 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -708,6 +708,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length);
void log_slow_statement(THD *thd);
bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
+bool compare_record(TABLE *table, query_id_t query_id);
bool table_cache_init(void);
void table_cache_free(void);
@@ -938,7 +939,8 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
-bool get_schema_tables_result(JOIN *join);
+bool get_schema_tables_result(JOIN *join,
+ enum enum_schema_table_state executed_place);
#define is_schema_db(X) \
!my_strcasecmp(system_charset_info, information_schema_name.str, (X))
@@ -1272,6 +1274,7 @@ extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
+extern char* opt_secure_file_priv;
extern my_bool opt_log_slow_admin_statements;
extern my_bool sp_automatic_privileges, opt_noacl;
extern my_bool opt_old_style_user_limits, trust_function_creators;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5a805b586fd..de28cb9b92f 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -363,6 +363,7 @@ ulong opt_ndb_nodeid;
my_bool opt_readonly, use_temp_pool, relay_log_purge;
my_bool opt_sync_frm, opt_allow_suspicious_udfs;
my_bool opt_secure_auth= 0;
+char* opt_secure_file_priv= 0;
my_bool opt_log_slow_admin_statements= 0;
my_bool lower_case_file_system= 0;
my_bool opt_large_pages= 0;
@@ -1144,6 +1145,7 @@ void clean_up(bool print_message)
#endif
x_free(opt_bin_logname);
x_free(opt_relay_logname);
+ x_free(opt_secure_file_priv);
bitmap_free(&temp_pool);
free_max_user_conn();
#ifdef HAVE_REPLICATION
@@ -2722,10 +2724,33 @@ static int init_common_variables(const char *conf_file_name, int argc,
#ifdef USE_REGEX
my_regex_init(&my_charset_latin1);
#endif
- if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
- MY_CS_PRIMARY,
- MYF(MY_WME))))
- return 1;
+ /*
+ Process a comma-separated character set list and choose
+ the first available character set. This is mostly for
+ test purposes, to be able to start "mysqld" even if
+ the requested character set is not available (see bug#18743).
+ */
+ for (;;)
+ {
+ char *next_character_set_name= strchr(default_character_set_name, ',');
+ if (next_character_set_name)
+ *next_character_set_name++= '\0';
+ if (!(default_charset_info=
+ get_charset_by_csname(default_character_set_name,
+ MY_CS_PRIMARY, MYF(MY_WME))))
+ {
+ if (next_character_set_name)
+ {
+ default_character_set_name= next_character_set_name;
+ default_collation_name= 0; // Ignore collation
+ }
+ else
+ return 1; // Eof of the list
+ }
+ else
+ break;
+ }
+
if (default_collation_name)
{
CHARSET_INFO *default_collation;
@@ -4700,7 +4725,8 @@ enum options_mysqld
OPT_TABLE_LOCK_WAIT_TIMEOUT,
OPT_PORT_OPEN_TIMEOUT,
OPT_MERGE,
- OPT_INNODB_ROLLBACK_ON_TIMEOUT
+ OPT_INNODB_ROLLBACK_ON_TIMEOUT,
+ OPT_SECURE_FILE_PRIV
};
@@ -5350,6 +5376,10 @@ Can't be set to 1 if --log-slave-updates is used.",
{"secure-auth", OPT_SECURE_AUTH, "Disallow authentication for accounts that have old (pre-4.1) passwords.",
(gptr*) &opt_secure_auth, (gptr*) &opt_secure_auth, 0, GET_BOOL, NO_ARG,
my_bool(0), 0, 0, 0, 0, 0},
+ {"secure-file-priv", OPT_SECURE_FILE_PRIV,
+ "Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files within specified directory",
+ (gptr*) &opt_secure_file_priv, (gptr*) &opt_secure_file_priv, 0,
+ GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"server-id", OPT_SERVER_ID,
"Uniquely identifies the server instance in the community of replication partners.",
(gptr*) &server_id, (gptr*) &server_id, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 0,
@@ -6379,6 +6409,7 @@ static void mysql_init_variables(void)
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
opt_secure_auth= 0;
+ opt_secure_file_priv= 0;
opt_bootstrap= opt_myisam_log= 0;
mqh_used= 0;
segfaulted= kill_in_progress= 0;
@@ -7417,6 +7448,16 @@ static void fix_paths(void)
exit(1);
}
#endif /* HAVE_REPLICATION */
+ /*
+ Convert the secure-file-priv option to system format, allowing
+ a quick strcmp to check if read or write is in an allowed dir
+ */
+ if (opt_secure_file_priv)
+ {
+ convert_dirname(buff, opt_secure_file_priv, NullS);
+ my_free(opt_secure_file_priv, MYF(0));
+ opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
+ }
}
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index f0af4b7db2a..4838e690dd7 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -4296,7 +4296,22 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
err= value->save_in_field_no_warnings(field, 1);
if (err > 0 && field->cmp_type() != value->result_type())
{
- tree= 0;
+ if ((type == Item_func::EQ_FUNC || type == Item_func::EQUAL_FUNC) &&
+ value->result_type() == item_cmp_type(field->result_type(),
+ value->result_type()))
+
+ {
+ tree= new (alloc) SEL_ARG(field, 0, 0);
+ tree->type= SEL_ARG::IMPOSSIBLE;
+ }
+ else
+ {
+ /*
+ TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE
+ for the cases like int_field > 999999999999999999999999 as well.
+ */
+ tree= 0;
+ }
goto end;
}
if (err < 0)
@@ -8750,14 +8765,13 @@ int QUICK_GROUP_MIN_MAX_SELECT::reset(void)
DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::reset");
file->extra(HA_EXTRA_KEYREAD); /* We need only the key attributes */
- result= file->ha_index_init(index);
- result= file->index_last(record);
- if (result == HA_ERR_END_OF_FILE)
- DBUG_RETURN(0);
- if (result)
+ if ((result= file->ha_index_init(index)))
DBUG_RETURN(result);
if (quick_prefix_select && quick_prefix_select->reset())
DBUG_RETURN(1);
+ result= file->index_last(record);
+ if (result == HA_ERR_END_OF_FILE)
+ DBUG_RETURN(0);
/* Save the prefix of the last group. */
key_copy(last_prefix, record, index_info, group_prefix_len);
@@ -8806,7 +8820,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next()
#else
int result;
#endif
- int is_last_prefix;
+ int is_last_prefix= 0;
DBUG_ENTER("QUICK_GROUP_MIN_MAX_SELECT::get_next");
@@ -8821,13 +8835,18 @@ int QUICK_GROUP_MIN_MAX_SELECT::get_next()
Check if this is the last group prefix. Notice that at this point
this->record contains the current prefix in record format.
*/
- is_last_prefix= key_cmp(index_info->key_part, last_prefix,
- group_prefix_len);
- DBUG_ASSERT(is_last_prefix <= 0);
- if (result == HA_ERR_KEY_NOT_FOUND)
- continue;
- else if (result)
+ if (!result)
+ {
+ is_last_prefix= key_cmp(index_info->key_part, last_prefix,
+ group_prefix_len);
+ DBUG_ASSERT(is_last_prefix <= 0);
+ }
+ else
+ {
+ if (result == HA_ERR_KEY_NOT_FOUND)
+ continue;
break;
+ }
if (have_min)
{
diff --git a/sql/set_var.cc b/sql/set_var.cc
index be9d73a091c..29917f2f83c 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -358,6 +358,8 @@ sys_query_cache_wlock_invalidate("query_cache_wlock_invalidate",
&SV::query_cache_wlock_invalidate);
#endif /* HAVE_QUERY_CACHE */
sys_var_bool_ptr sys_secure_auth("secure_auth", &opt_secure_auth);
+sys_var_const_str_ptr sys_secure_file_priv("secure_file_priv",
+ &opt_secure_file_priv);
sys_var_long_ptr sys_server_id("server_id", &server_id, fix_server_id);
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
@@ -719,6 +721,7 @@ sys_var *sys_variables[]=
&sys_rpl_recovery_rank,
&sys_safe_updates,
&sys_secure_auth,
+ &sys_secure_file_priv,
&sys_select_limit,
&sys_server_id,
#ifdef HAVE_REPLICATION
@@ -1027,6 +1030,7 @@ struct show_var_st init_vars[]= {
#endif
{sys_rpl_recovery_rank.name,(char*) &sys_rpl_recovery_rank, SHOW_SYS},
{"secure_auth", (char*) &sys_secure_auth, SHOW_SYS},
+ {"secure_file_priv", (char*) &sys_secure_file_priv, SHOW_SYS},
#ifdef HAVE_SMEM
{"shared_memory", (char*) &opt_enable_shared_memory, SHOW_MY_BOOL},
{"shared_memory_base_name", (char*) &shared_memory_base_name, SHOW_CHAR_PTR},
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 3b612dadcd0..714b1244be4 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1081,7 +1081,7 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
IO_CACHE *cache)
{
File file;
- uint option= MY_UNPACK_FILENAME;
+ uint option= MY_UNPACK_FILENAME | MY_RELATIVE_PATH;
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
option|= MY_REPLACE_DIR; // Force use of db directory
@@ -1094,7 +1094,15 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
}
else
(void) fn_format(path, exchange->file_name, mysql_real_data_home, "", option);
-
+
+ if (opt_secure_file_priv &&
+ strncmp(opt_secure_file_priv, path, strlen(opt_secure_file_priv)))
+ {
+ /* Write only allowed to dir or subdir specified by secure_file_priv */
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
+ return -1;
+ }
+
if (!access(path, F_OK))
{
my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 05034ebd573..1fe5ef54043 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -1674,7 +1674,7 @@ public:
#define SYSTEM_THREAD_SLAVE_SQL 4
/*
- Used to hold information about file and file structure in exchainge
+ Used to hold information about file and file structure in exchange
via non-DB file (...INTO OUTFILE..., ...LOAD DATA...)
XXX: We never call destructor for objects of this class.
*/
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index fb59aeea8e7..39d7f8e9b58 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -1186,23 +1186,29 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
goto before_trg_err;
if ((error=table->file->update_row(table->record[1],table->record[0])))
- {
- if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
+ {
+ if ((error == HA_ERR_FOUND_DUPP_KEY) && info->ignore)
{
table->file->restore_auto_increment();
goto ok_or_after_trg_err;
}
goto err;
- }
- info->updated++;
+ }
+ if ((table->file->table_flags() & HA_PARTIAL_COLUMN_READ) ||
+ compare_record(table, query_id))
+ {
+ info->updated++;
- if (table->next_number_field)
- table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
+ if (table->next_number_field)
+ table->file->adjust_next_insert_id_after_explicit_value(
+ table->next_number_field->val_int());
- trg_error= (table->triggers &&
- table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
- TRG_ACTION_AFTER, TRUE));
- info->copied++;
+ trg_error= (table->triggers &&
+ table->triggers->process_triggers(thd, TRG_EVENT_UPDATE,
+ TRG_ACTION_AFTER,
+ TRUE));
+ info->copied++;
+ }
goto ok_or_after_trg_err;
}
else /* DUP_REPLACE */
@@ -2624,7 +2630,7 @@ bool select_insert::send_eof()
}
if (last_insert_id)
- thd->insert_id(last_insert_id); // For binary log
+ thd->insert_id(info.copied ? last_insert_id : 0); // For binary log
/* Write to binlog before commiting transaction */
if (mysql_bin_log.is_open())
{
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index a362e6c7fd2..ce76c35b33c 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1751,7 +1751,6 @@ bool st_lex::can_be_merged()
}
return (selects_allow_merge &&
- select_lex.order_list.elements == 0 &&
select_lex.group_list.elements == 0 &&
select_lex.having == 0 &&
select_lex.with_sum_func == 0 &&
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 0e4057d9ae4..ede70adc378 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -302,6 +302,15 @@ bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
is_fifo = 1;
#endif
+
+ if (opt_secure_file_priv &&
+ strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
+ {
+ /* Read only allowed from within dir specified by secure_file_priv */
+ my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");
+ DBUG_RETURN(TRUE);
+ }
+
}
if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
DBUG_RETURN(TRUE);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c9f0108f6bf..ed108828909 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1505,7 +1505,7 @@ JOIN::exec()
if ((curr_join->select_lex->options & OPTION_SCHEMA_TABLE) &&
!thd->lex->describe &&
- get_schema_tables_result(curr_join))
+ get_schema_tables_result(curr_join, PROCESSED_BY_JOIN_EXEC))
{
DBUG_VOID_RETURN;
}
@@ -12374,7 +12374,7 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order,
/* Fill schema tables with data before filesort if it's necessary */
if ((join->select_lex->options & OPTION_SCHEMA_TABLE) &&
!thd->lex->describe &&
- get_schema_tables_result(join))
+ get_schema_tables_result(join, PROCESSED_BY_CREATE_SORT_INDEX))
goto err;
if (table->s->tmp_table)
@@ -12746,15 +12746,15 @@ SORT_FIELD *make_unireg_sortorder(ORDER *order, uint *length,
for (;order;order=order->next,pos++)
{
- pos->field=0; pos->item=0;
- if (order->item[0]->type() == Item::FIELD_ITEM)
- pos->field= ((Item_field*) (*order->item))->field;
- else if (order->item[0]->type() == Item::SUM_FUNC_ITEM &&
- !order->item[0]->const_item())
- pos->field= ((Item_sum*) order->item[0])->get_tmp_table_field();
- else if (order->item[0]->type() == Item::COPY_STR_ITEM)
+ Item *item= order->item[0]->real_item();
+ pos->field= 0; pos->item= 0;
+ if (item->type() == Item::FIELD_ITEM)
+ pos->field= ((Item_field*) item)->field;
+ else if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item())
+ pos->field= ((Item_sum*) item)->get_tmp_table_field();
+ else if (item->type() == Item::COPY_STR_ITEM)
{ // Blob patch
- pos->item= ((Item_copy_string*) (*order->item))->item;
+ pos->item= ((Item_copy_string*) item)->item;
}
else
pos->item= *order->item;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 23059ac545a..659dd49d537 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3938,13 +3938,15 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
SYNOPSIS
get_schema_tables_result()
join join which use schema tables
+ executed_place place where I_S table processed
RETURN
FALSE success
TRUE error
*/
-bool get_schema_tables_result(JOIN *join)
+bool get_schema_tables_result(JOIN *join,
+ enum enum_schema_table_state executed_place)
{
JOIN_TAB *tmp_join_tab= join->join_tab+join->tables;
THD *thd= join->thd;
@@ -3964,14 +3966,24 @@ bool get_schema_tables_result(JOIN *join)
bool is_subselect= (&lex->unit != lex->current_select->master_unit() &&
lex->current_select->master_unit()->item);
/*
- The schema table is already processed and
- the statement is not a subselect.
- So we don't need to handle this table again.
+ If schema table is already processed and
+ the statement is not a subselect then
+ we don't need to fill this table again.
+ If schema table is already processed and
+ schema_table_state != executed_place then
+ table is already processed and
+ we should skip second data processing.
*/
- if (table_list->is_schema_table_processed && !is_subselect)
+ if (table_list->schema_table_state &&
+ (!is_subselect || table_list->schema_table_state != executed_place))
continue;
- if (is_subselect) // is subselect
+ /*
+ if table is used in a subselect and
+ table has been processed earlier with the same
+ 'executed_place' value then we should refresh the table.
+ */
+ if (table_list->schema_table_state && is_subselect)
{
table_list->table->file->extra(HA_EXTRA_NO_CACHE);
table_list->table->file->extra(HA_EXTRA_RESET_STATE);
@@ -3988,10 +4000,10 @@ bool get_schema_tables_result(JOIN *join)
{
result= 1;
join->error= 1;
- table_list->is_schema_table_processed= TRUE;
+ table_list->schema_table_state= executed_place;
break;
}
- table_list->is_schema_table_processed= TRUE;
+ table_list->schema_table_state= executed_place;
}
}
thd->no_warnings_for_error= 0;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index b85c617b12d..1db77f8704c 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -26,7 +26,7 @@
/* Return 0 if row hasn't changed */
-static bool compare_record(TABLE *table, query_id_t query_id)
+bool compare_record(TABLE *table, query_id_t query_id)
{
if (table->s->blob_fields + table->s->varchar_fields == 0)
return cmp_record(table,record[1]);
@@ -1445,6 +1445,15 @@ int multi_update::do_updates(bool from_send_error)
if (!can_compare_record || compare_record(table, thd->query_id))
{
+ int error;
+ if ((error= cur_table->view_check_option(thd, ignore)) !=
+ VIEW_CHECK_OK)
+ {
+ if (error == VIEW_CHECK_SKIP)
+ continue;
+ else if (error == VIEW_CHECK_ERROR)
+ goto err;
+ }
if ((local_error=table->file->update_row(table->record[1],
table->record[0])))
{
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 18ef3eaf29c..fd2d6c89785 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1263,6 +1263,7 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
but it will not be included to SELECT_LEX tree, because it
will not be executed
*/
+ table->select_lex->order_list.push_back(&lex->select_lex.order_list);
goto ok;
}
diff --git a/sql/table.cc b/sql/table.cc
index a6750b2b4d7..e2cb0bea300 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -3020,7 +3020,7 @@ void st_table_list::reinit_before_use(THD *thd)
*/
table= 0;
/* Reset is_schema_table_processed value(needed for I_S tables */
- is_schema_table_processed= FALSE;
+ schema_table_state= NOT_PROCESSED;
TABLE_LIST *embedded; /* The table at the current level of nesting. */
TABLE_LIST *embedding= this; /* The parent nested table reference. */
diff --git a/sql/table.h b/sql/table.h
index 70e64439af5..8f013f3de19 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -287,6 +287,12 @@ struct st_table {
void reset_item_list(List<Item> *item_list) const;
};
+enum enum_schema_table_state
+{
+ NOT_PROCESSED= 0,
+ PROCESSED_BY_CREATE_SORT_INDEX,
+ PROCESSED_BY_JOIN_EXEC
+};
typedef struct st_foreign_key_info
{
@@ -529,7 +535,6 @@ typedef struct st_table_list
st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */
ST_SCHEMA_TABLE *schema_table; /* Information_schema table */
st_select_lex *schema_select_lex;
- bool is_schema_table_processed;
/*
True when the view field translation table is used to convert
schema table fields for backwards compatibility with SHOW command.
@@ -638,6 +643,7 @@ typedef struct st_table_list
*/
bool prelocking_placeholder;
+ enum enum_schema_table_state schema_table_state;
void calc_md5(char *buffer);
void set_underlying_merge();
int view_check_option(THD *thd, bool ignore_failure);