Commit c130d8cd authored by Patrick Crews's avatar Patrick Crews

merge

parents e23900e1 79a047c5
No related merge requests found
...@@ -616,6 +616,18 @@ static int run_mysqlcheck_upgrade(void) ...@@ -616,6 +616,18 @@ static int run_mysqlcheck_upgrade(void)
"--check-upgrade", "--check-upgrade",
"--all-databases", "--all-databases",
"--auto-repair", "--auto-repair",
NULL);
}
static int run_mysqlcheck_fixnames(void)
{
verbose("Running 'mysqlcheck'...");
return run_tool(mysqlcheck_path,
NULL, /* Send output from mysqlcheck directly to screen */
"--no-defaults",
ds_args.str,
"--all-databases",
"--fix-db-names", "--fix-db-names",
"--fix-table-names", "--fix-table-names",
NULL); NULL);
...@@ -784,7 +796,8 @@ int main(int argc, char **argv) ...@@ -784,7 +796,8 @@ int main(int argc, char **argv)
/* /*
Run "mysqlcheck" and "mysql_fix_privilege_tables.sql" Run "mysqlcheck" and "mysql_fix_privilege_tables.sql"
*/ */
if (run_mysqlcheck_upgrade() || if (run_mysqlcheck_fixnames() ||
run_mysqlcheck_upgrade() ||
run_sql_fix_privilege_tables()) run_sql_fix_privilege_tables())
{ {
/* /*
......
...@@ -996,6 +996,22 @@ SELECT * FROM t1; ...@@ -996,6 +996,22 @@ SELECT * FROM t1;
v b v b
abc 5 abc 5
DROP TABLE t1; DROP TABLE t1;
create table t1 (a tinytext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create table t1 (a mediumtext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
End of 5.0 tests End of 5.0 tests
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
create table t1 (i int); create table t1 (i int);
......
...@@ -522,3 +522,12 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; ...@@ -522,3 +522,12 @@ WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 const 4 Using where 1 SIMPLE t1 ref b b 5 const 4 Using where
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a CHAR(10));
INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE)
1
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
2
DROP TABLE t1;
...@@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'), ...@@ -717,8 +717,6 @@ insert(_latin2'abcd',2,3,_latin2'ef'),
replace(_latin2'abcd',_latin2'b',_latin2'B'), replace(_latin2'abcd',_latin2'b',_latin2'B'),
encode('abcd','ab') encode('abcd','ab')
; ;
Warnings:
Warning 1265 Data truncated for column 'format(130,10)' at row 1
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
...@@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` ( ...@@ -727,7 +725,7 @@ t1 CREATE TABLE `t1` (
`conv(130,16,10)` varchar(64) DEFAULT NULL, `conv(130,16,10)` varchar(64) DEFAULT NULL,
`hex(130)` varchar(6) NOT NULL DEFAULT '', `hex(130)` varchar(6) NOT NULL DEFAULT '',
`char(130)` varbinary(4) NOT NULL DEFAULT '', `char(130)` varbinary(4) NOT NULL DEFAULT '',
`format(130,10)` varchar(4) NOT NULL DEFAULT '', `format(130,10)` varchar(37) NOT NULL DEFAULT '',
`left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', `left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
`right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', `right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
`lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '', `lcase(_latin2'a')` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
...@@ -2513,4 +2511,12 @@ SELECT HEX(c1) from v1; ...@@ -2513,4 +2511,12 @@ SELECT HEX(c1) from v1;
HEX(c1) HEX(c1)
414243 414243
DROP VIEW v1; DROP VIEW v1;
create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def format(a, 2) 253 49 4 Y 0 31 8
format(a, 2)
1.33
drop table t1;
End of 5.0 tests End of 5.0 tests
...@@ -40,3 +40,4 @@ count(*) ...@@ -40,3 +40,4 @@ count(*)
65536 65536
DROP PROCEDURE sp_addRec; DROP PROCEDURE sp_addRec;
DROP TABLE t1; DROP TABLE t1;
SET @@global.myisam_data_pointer_size = default;
...@@ -27,3 +27,25 @@ CHECK TABLE t1 EXTENDED; ...@@ -27,3 +27,25 @@ CHECK TABLE t1 EXTENDED;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
drop table if exists t1;
create table t1(f1 int, f2 varchar(255));
insert into t1 values(1, 'foo'), (2, 'bar');
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
flush tables;
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize error Table 'test.t1' is read only
Warnings:
Error 1036 Table 't1' is read only
drop table t1;
...@@ -324,7 +324,7 @@ partition by hash (a) ...@@ -324,7 +324,7 @@ partition by hash (a)
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL DEFAULT '\0\0\0\0', `a` bit(27) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (a) /*!50100 PARTITION BY HASH (a)
......
...@@ -708,6 +708,47 @@ HEX(b1) HEX(b2) i2 ...@@ -708,6 +708,47 @@ HEX(b1) HEX(b2) i2
1 0 100 1 0 100
1 0 200 1 0 200
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'10',
f2 bit(14) NOT NULL default b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` bit(2) NOT NULL DEFAULT b'10',
`f2` bit(14) NOT NULL DEFAULT b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
DROP TABLE t1;
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
ERROR 42000: Invalid default value for 'f1'
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
create table t2bit7 (b1 bit(7)) engine=MyISAM;
insert into t1bit7 values (b'1100000');
insert into t1bit7 values (b'1100001');
insert into t1bit7 values (b'1100010');
insert into t2bit7 values (b'1100001');
insert into t2bit7 values (b'1100010');
insert into t2bit7 values (b'1100110');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
bin(a1)
1100001
1100010
drop table t1bit7, t2bit7;
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
create table t2bit7 (b1 bit(15)) engine=MyISAM;
insert into t1bit7 values (b'110000011111111');
insert into t1bit7 values (b'110000111111111');
insert into t1bit7 values (b'110001011111111');
insert into t2bit7 values (b'110000111111111');
insert into t2bit7 values (b'110001011111111');
insert into t2bit7 values (b'110011011111111');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
bin(a1)
110000111111111
110001011111111
drop table t1bit7, t2bit7;
End of 5.0 tests End of 5.0 tests
create table t1(a bit(7)); create table t1(a bit(7));
insert into t1 values(0x40); insert into t1 values(0x40);
......
...@@ -398,11 +398,11 @@ insert into t1(d) values (9.2233720368547777e+18), ...@@ -398,11 +398,11 @@ insert into t1(d) values (9.2233720368547777e+18),
(9.22337203685479e18), (9.22337203685479e18),
(1.84e19); (1.84e19);
update t1 set u = d; update t1 set u = d;
select * from t1; select u from t1;
d u u
9.22337203685478e+18 9223372036854775808 9223372036854775808
9.22337203685478e+18 9223372036854779904 9223372036854779904
9.22337203685479e+18 9223372036854790144 9223372036854790144
1.84e+19 18400000000000000000 18400000000000000000
drop table t1; drop table t1;
End of 5.0 tests End of 5.0 tests
CREATE TABLE t1 (i int unique) ENGINE=innodb;
reset master;
begin;
insert into t1 values (1),(2);
*** the following UPDATE query wont generate any updates for the binlog ***
update t1 set i = 3 where i < 3;
ERROR 23000: Duplicate entry '3' for key 'i'
commit;
*** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
reset master;
begin;
insert into t1 values (1),(2);
*** the following UPDATE query wont generate any updates for the binlog ***
insert into t1 values (3),(4),(1),(2);
ERROR 23000: Duplicate entry '1' for key 'i'
commit;
*** Results of the test: the binlog must have only one Write_rows event not two ***
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
drop table t1;
...@@ -385,8 +385,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */ ...@@ -385,8 +385,6 @@ master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; COMMIT master-bin.000001 # Query # # use `test`; COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t2 master-bin.000001 # Query # # use `test`; DROP TABLE t2
master-bin.000001 # Query # # use `test`; BEGIN master-bin.000001 # Query # # use `test`; BEGIN
......
#
# Tests of innodb/binlog with the row binlog format
#
source include/have_innodb.inc;
source include/have_log_bin.inc;
source include/have_binlog_format_row.inc;
#
# Bug #40221 Replication failure on RBR + UPDATE the primary key
#
CREATE TABLE t1 (i int unique) ENGINE=innodb;
reset master;
# part 1: update can cause the dup key
begin;
insert into t1 values (1),(2);
--echo *** the following UPDATE query wont generate any updates for the binlog ***
--error ER_DUP_ENTRY
update t1 set i = 3 where i < 3;
commit;
--echo *** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
source include/show_binlog_events.inc;
# part 2: insert can cause the dup key
delete from t1;
reset master;
begin;
insert into t1 values (1),(2);
--echo *** the following UPDATE query wont generate any updates for the binlog ***
--error ER_DUP_ENTRY
insert into t1 values (3),(4),(1),(2);
commit;
--echo *** Results of the test: the binlog must have only one Write_rows event not two ***
source include/show_binlog_events.inc;
drop table t1;
# Disabled by hhunger (2008-03-03) due to WL4204 # Disabled by hhunger (2008-03-03) due to WL4204
innodb_charset : Due to bug#20447 innodb_charset : Bug#20447 Problem with prefix keys with contractions and expansions
myisam_charset : Due to bug#20477 myisam_charset : Bug#20447 Problem with prefix keys with contractions and expansions
memory_charset : Due to bug#20447 memory_charset : Bug#20447 Problem with prefix keys with contractions and expansions
ndb_charset : Due to bug#20447 ndb_charset : Bug#20447 Problem with prefix keys with contractions and expansions
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
# Do not use any TAB characters for whitespace. # Do not use any TAB characters for whitespace.
# #
############################################################################## ##############################################################################
partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when updating a range partitioned NDB table
ndb_partition_error2 : HF is not sure if the test can work as internded on all the platforms ndb_partition_error2 : Bug#40989 ndb_partition_error2 needs maintenance
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
...@@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a) ...@@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='INNODB' partition by key (a)
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */ /*!50100 PARTITION BY KEY (a) */
...@@ -18,7 +18,7 @@ partition pa2); ...@@ -18,7 +18,7 @@ partition pa2);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -30,7 +30,7 @@ partition by key (a) partitions 2; ...@@ -30,7 +30,7 @@ partition by key (a) partitions 2;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', `a` bit(64) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2); ...@@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', `a` bit(64) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -88,7 +88,7 @@ partition by key (a) partitions 4; ...@@ -88,7 +88,7 @@ partition by key (a) partitions 4;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -102,7 +102,7 @@ alter table t2 drop primary key; ...@@ -102,7 +102,7 @@ alter table t2 drop primary key;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bit(1) NOT NULL DEFAULT '\0' `a` bit(1) NOT NULL DEFAULT b'0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
PARTITIONS 4 */ PARTITIONS 4 */
...@@ -114,7 +114,7 @@ alter table t2 add primary key (a); ...@@ -114,7 +114,7 @@ alter table t2 add primary key (a);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -133,7 +133,7 @@ partition pa4 values less than (256)); ...@@ -133,7 +133,7 @@ partition pa4 values less than (256));
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` bit(8) NOT NULL DEFAULT '\0', `a` bit(8) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a) /*!50100 PARTITION BY RANGE (a)
...@@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)); ...@@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32));
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` bit(8) NOT NULL DEFAULT '\0', `a` bit(8) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (a) /*!50100 PARTITION BY LIST (a)
......
...@@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a) ...@@ -6,7 +6,7 @@ create table t1 (a bit(0), primary key (a)) engine='MyISAM' partition by key (a)
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */ /*!50100 PARTITION BY KEY (a) */
...@@ -18,7 +18,7 @@ partition pa2); ...@@ -18,7 +18,7 @@ partition pa2);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -30,7 +30,7 @@ partition by key (a) partitions 2; ...@@ -30,7 +30,7 @@ partition by key (a) partitions 2;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', `a` bit(64) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2); ...@@ -58,7 +58,7 @@ partition pa4 max_rows=40 min_rows=2);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0', `a` bit(64) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -88,7 +88,7 @@ partition by key (a) partitions 4; ...@@ -88,7 +88,7 @@ partition by key (a) partitions 4;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -102,7 +102,7 @@ alter table t2 drop primary key; ...@@ -102,7 +102,7 @@ alter table t2 drop primary key;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bit(1) NOT NULL DEFAULT '\0' `a` bit(1) NOT NULL DEFAULT b'0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
PARTITIONS 4 */ PARTITIONS 4 */
...@@ -114,7 +114,7 @@ alter table t2 add primary key (a); ...@@ -114,7 +114,7 @@ alter table t2 add primary key (a);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` bit(1) NOT NULL DEFAULT '\0', `a` bit(1) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) /*!50100 PARTITION BY KEY (a)
...@@ -133,7 +133,7 @@ partition pa4 values less than (256)); ...@@ -133,7 +133,7 @@ partition pa4 values less than (256));
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` bit(8) NOT NULL DEFAULT '\0', `a` bit(8) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (a) /*!50100 PARTITION BY RANGE (a)
...@@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)); ...@@ -416,7 +416,7 @@ partition pa3 values in (17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32));
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` bit(8) NOT NULL DEFAULT '\0', `a` bit(8) NOT NULL DEFAULT b'0',
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY LIST (a) /*!50100 PARTITION BY LIST (a)
......
SET @max_row = 20;
create table t1 (a bit(65), primary key (a)) partition by key (a);
ERROR 42000: Display width out of range for column 'a' (max = 64)
create table t1 (a bit(0), primary key (a)) partition by key (a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
drop table t1;
create table t1 (a bit(0), primary key (a)) partition by key (a) (
partition pa1 DATA DIRECTORY =
'/tmp' INDEX DIRECTORY =
'/tmp',
partition pa2 DATA DIRECTORY =
'/tmp' INDEX DIRECTORY =
'/tmp');
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/' INDEX DIRECTORY='/tmp/'
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM,
PARTITION pa2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */
drop table t1;
create table t1 (a bit(64), primary key (a)) partition by key (a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'),
(b'1000000000000000000000000000000000000000000000000000000000000000'),
(b'0000000000000000000000000000000000000000000000000000000000000001'),
(b'1010101010101010101010101010101010101010101010101010101010101010'),
(b'0101010101010101010101010101010101010101010101010101010101010101');
select hex(a) from t1;
hex(a)
1
5555555555555555
8000000000000000
AAAAAAAAAAAAAAAA
FFFFFFFFFFFFFFFF
drop table t1;
create table t1 (a bit(64), primary key (a)) partition by key (a)(
partition pa1 DATA DIRECTORY =
'/tmp' INDEX DIRECTORY =
'/tmp' max_rows=20 min_rows=2,
partition pa2 DATA DIRECTORY =
'/tmp' INDEX DIRECTORY =
'/tmp' max_rows=30 min_rows=3,
partition pa3 DATA DIRECTORY =
'/tmp' INDEX DIRECTORY =
'/tmp' max_rows=30 min_rows=4,
partition pa4 DATA DIRECTORY =
'/tmp' INDEX DIRECTORY =
'/tmp' max_rows=40 min_rows=2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(64) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='/tmp/' INDEX DIRECTORY='/tmp/'
/*!50100 PARTITION BY KEY (a)
(PARTITION pa1 MAX_ROWS = 20 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM,
PARTITION pa2 MAX_ROWS = 30 MIN_ROWS = 3 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM,
PARTITION pa3 MAX_ROWS = 30 MIN_ROWS = 4 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM,
PARTITION pa4 MAX_ROWS = 40 MIN_ROWS = 2 DATA DIRECTORY = '/tmp' INDEX DIRECTORY = '/tmp' ENGINE = MyISAM) */
insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'),
(b'1000000000000000000000000000000000000000000000000000000000000000'),
(b'0000000000000000000000000000000000000000000000000000000000000001'),
(b'1010101010101010101010101010101010101010101010101010101010101010'),
(b'0101010101010101010101010101010101010101010101010101010101010101');
select hex(a) from t1;
hex(a)
1
5555555555555555
8000000000000000
AAAAAAAAAAAAAAAA
FFFFFFFFFFFFFFFF
drop table t1;
create table t1 (a bit, primary key (a)) partition by key (a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
insert into t1 values (b'0'), (b'1');
select hex(a) from t1;
hex(a)
0
1
alter table t1 drop primary key;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
select hex(a) from t1;
hex(a)
0
1
alter table t1 add primary key (a);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(1) NOT NULL DEFAULT '\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY KEY (a) */
select hex(a) from t1;
hex(a)
0
1
drop table t1;
partition_basic_ndb : Bug#19899 Crashing the server partition_basic_ndb : Bug#19899 Crashing the server
# http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html # http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-syntax.html
partition_bit_ndb : NDB does not support bit column in index
partition_sessions : needs system_3_init.inc
partition_syntax_ndb : Bug#36735 Not supported partition_syntax_ndb : Bug#36735 Not supported
partition_value_innodb : Bug#30581 partition_value tests use disallowed CAST() function
partition_value_myisam : Bug#30581 partition_value tests use disallowed CAST() function
partition_value_ndb : Bug#30581 partition_value tests use disallowed CAST() function
################################################################################
# t/partition_bit_ndb.test #
# #
# Purpose: #
# Tests around bit type #
# NDB branch #
# #
#------------------------------------------------------------------------------#
# Original Author: HH #
# Original Date: 2006-08-01 #
# Change Author: #
# Change Date: #
# Change: #
################################################################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# TESTCASES WHICH MUST BE APPLIED TO ALL STORAGE ENGINES MUST BE ADDED IN
# THE SOURCED FILES ONLY.
#
# Please read the README at the end of inc/partition.pre before changing
# any of the variables.
#
#------------------------------------------------------------------------------#
# General not engine specific settings and requirements
##### Options, for debugging support #####
let $debug= 0;
let $with_partitioning= 1;
##### Option, for displaying files #####
let $ls= 1;
##### Number of rows for the INSERT/UPDATE/DELETE/SELECT experiments #####
# on partioned tables
SET @max_row = 20;
# The server must support partitioning.
--source include/have_partition.inc
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
##### Storage engine to be tested
--source include/have_ndb.inc
let $engine= 'NDB';
connection default;
# range, list and hash partitioning in ndb requires new_mode
--disable_query_log
set new=on;
--enable_query_log
##### Assign a big number smaller than the maximum value for partitions #####
# and smaller than the maximum value of SIGNED INTEGER
let $MAX_VALUE= (2147483646);
#------------------------------------------------------------------------------#
# Execute the tests to be applied to all storage engines
--source suite/parts/inc/partition_bit.inc
This diff is collapsed.
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Original Author: mleich # # Original Author: mleich #
# Original Date: 2006-04-11 # # Original Date: 2006-04-11 #
# Change Author: # # Change Author: mleich #
# Change Date: # # Change Date: 2008-12-08 #
# Change: # # Change: Remove test from disabled.def + change test that it gets skipped #
################################################################################ ################################################################################
# #
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
# any of the variables. # any of the variables.
# #
#
# CAST() within the partitioning function si no more supported, but we get
# this functionality probably soon again. Therefor we do not delete this test.
--skip # CAST() in partitioning function is currently not supported.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# General not engine specific settings and requirements # General not engine specific settings and requirements
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Original Author: mleich # # Original Author: mleich #
# Original Date: 2006-04-11 # # Original Date: 2006-04-11 #
# Change Author: # # Change Author: mleich #
# Change Date: # # Change Date: 2008-12-08 #
# Change: # # Change: Remove test from disabled.def + change test that it gets skipped #
################################################################################ ################################################################################
# #
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
# any of the variables. # any of the variables.
# #
#
# CAST() within the partitioning function si no more supported, but we get
# this functionality probably soon again. Therefor we do not delete this test.
--skip # CAST() in partitioning function is currently not supported.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# General not engine specific settings and requirements # General not engine specific settings and requirements
......
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# Original Author: mleich # # Original Author: mleich #
# Original Date: 2006-04-11 # # Original Date: 2006-04-11 #
# Change Author: # # Change Author: mleich #
# Change Date: # # Change Date: 2008-12-08 #
# Change: # # Change: Remove test from disabled.def + change test that it gets skipped #
################################################################################ ################################################################################
# #
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
# any of the variables. # any of the variables.
# #
#
# CAST() within the partitioning function si no more supported, but we get
# this functionality probably soon again. Therefor we do not delete this test.
--skip # CAST() in partitioning function is currently not supported.
#------------------------------------------------------------------------------# #------------------------------------------------------------------------------#
# General not engine specific settings and requirements # General not engine specific settings and requirements
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
############################################################################## ##############################################################################
rpl_ndb_circular : Bug#33849 COMMIT event missing in cluster circular replication. rpl_ndb_circular : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash
rpl_ndb_circular_simplex : Bug#33849 COMMIT event missing in cluster circular replication. rpl_ndb_circular_simplex : Bug#41183 rpl_ndb_circular, rpl_ndb_circular_simplex need maintenance, crash
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
...@@ -751,6 +751,19 @@ ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4); ...@@ -751,6 +751,19 @@ ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
#
create table t1 (a tinytext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
drop table t1;
create table t1 (a mediumtext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# #
......
...@@ -10,6 +10,5 @@ ...@@ -10,6 +10,5 @@
# #
############################################################################## ##############################################################################
federated_transactions : Bug#29523 Transactions do not work federated_transactions : Bug#29523 Transactions do not work
log_tables.test : Bug #37798: main.log_tables fails randomly on powermacg5 and windows slow_query_log_func : Bug #37962: *_func tests containing sleeps/race conditions
slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions
wait_timeout_func : Bug #41225 joro wait_timeout_func fails wait_timeout_func : Bug #41225 joro wait_timeout_func fails
...@@ -445,3 +445,12 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(b) ...@@ -445,3 +445,12 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(b)
WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1; WHERE MATCH(a) AGAINST('test' IN BOOLEAN MODE) AND b=1;
DROP TABLE t1; DROP TABLE t1;
#
# BUG#37245 - Full text search problem
#
CREATE TABLE t1(a CHAR(10));
INSERT INTO t1 VALUES('aaa15');
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa16' IN BOOLEAN MODE) FROM t1;
SELECT MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) FROM t1;
DROP TABLE t1;
...@@ -1263,4 +1263,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1; ...@@ -1263,4 +1263,14 @@ CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
SELECT HEX(c1) from v1; SELECT HEX(c1) from v1;
DROP VIEW v1; DROP VIEW v1;
#
# Bug #35558 Wrong server metadata blows up the client
#
create table t1(a float);
insert into t1 values (1.33);
--enable_metadata
select format(a, 2) from t1;
--disable_metadata
drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -105,6 +105,7 @@ SELECT count(*) from t1; ...@@ -105,6 +105,7 @@ SELECT count(*) from t1;
DROP PROCEDURE sp_addRec; DROP PROCEDURE sp_addRec;
DROP TABLE t1; DROP TABLE t1;
SET @@global.myisam_data_pointer_size = default;
################################################################ ################################################################
# End of functionality Testing for myisam_data_pointer_size # # End of functionality Testing for myisam_data_pointer_size #
################################################################ ################################################################
......
...@@ -31,3 +31,28 @@ FLUSH TABLES; ...@@ -31,3 +31,28 @@ FLUSH TABLES;
--exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1 --exec $MYISAMCHK -s --unpack $MYSQLTEST_VARDIR/master-data/test/t1
CHECK TABLE t1 EXTENDED; CHECK TABLE t1 EXTENDED;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#40949 Debug version of MySQL server crashes when run OPTIMIZE on compressed table.
#
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1(f1 int, f2 varchar(255));
insert into t1 values(1, 'foo'), (2, 'bar');
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
flush tables;
--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
optimize table t1;
drop table t1;
...@@ -352,6 +352,51 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2 ...@@ -352,6 +352,51 @@ SELECT HEX(b1), HEX(b2), i2 FROM t2
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Bug #35796 SHOW CREATE TABLE and default value for BIT field
#
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'10',
f2 bit(14) NOT NULL default b'11110000111100'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_INVALID_DEFAULT
CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
#
# Bug#31399 Wrong query result when doing join buffering over BIT fields
#
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
create table t2bit7 (b1 bit(7)) engine=MyISAM;
insert into t1bit7 values (b'1100000');
insert into t1bit7 values (b'1100001');
insert into t1bit7 values (b'1100010');
insert into t2bit7 values (b'1100001');
insert into t2bit7 values (b'1100010');
insert into t2bit7 values (b'1100110');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
drop table t1bit7, t2bit7;
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
create table t2bit7 (b1 bit(15)) engine=MyISAM;
insert into t1bit7 values (b'110000011111111');
insert into t1bit7 values (b'110000111111111');
insert into t1bit7 values (b'110001011111111');
insert into t2bit7 values (b'110000111111111');
insert into t2bit7 values (b'110001011111111');
insert into t2bit7 values (b'110011011111111');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
drop table t1bit7, t2bit7;
--echo End of 5.0 tests --echo End of 5.0 tests
# #
......
...@@ -265,7 +265,7 @@ insert into t1(d) values (9.2233720368547777e+18), ...@@ -265,7 +265,7 @@ insert into t1(d) values (9.2233720368547777e+18),
(1.84e19); (1.84e19);
update t1 set u = d; update t1 set u = d;
select * from t1; select u from t1;
drop table t1; drop table t1;
......
...@@ -3835,7 +3835,7 @@ int Field_longlong::store(double nr) ...@@ -3835,7 +3835,7 @@ int Field_longlong::store(double nr)
error= 1; error= 1;
} }
else else
res=(longlong) (ulonglong) nr; res=(longlong) double2ulonglong(nr);
} }
else else
{ {
......
...@@ -5114,6 +5114,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions) ...@@ -5114,6 +5114,9 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions)
ulonglong nr; ulonglong nr;
uint32 length= str_value.length(); uint32 length= str_value.length();
if (!length)
return 1;
if (length > 8) if (length > 8)
{ {
nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX; nr= field->flags & UNSIGNED_FLAG ? ULONGLONG_MAX : LONGLONG_MAX;
......
...@@ -2033,10 +2033,11 @@ Item_func_format::Item_func_format(Item *org, Item *dec) ...@@ -2033,10 +2033,11 @@ Item_func_format::Item_func_format(Item *org, Item *dec)
void Item_func_format::fix_length_and_dec() void Item_func_format::fix_length_and_dec()
{ {
collation.set(default_charset());
uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen; uint char_length= args[0]->max_length/args[0]->collation.collation->mbmaxlen;
max_length= ((char_length + (char_length-args[0]->decimals)/3) * uint max_sep_count= char_length/3 + (decimals ? 1 : 0) + /*sign*/1;
collation.collation->mbmaxlen); collation.set(default_charset());
max_length= (char_length + max_sep_count + decimals) *
collation.collation->mbmaxlen;
} }
......
...@@ -207,6 +207,7 @@ public: ...@@ -207,6 +207,7 @@ public:
truncate(0); truncate(0);
before_stmt_pos= MY_OFF_T_UNDEF; before_stmt_pos= MY_OFF_T_UNDEF;
trans_log.end_of_file= max_binlog_cache_size; trans_log.end_of_file= max_binlog_cache_size;
DBUG_ASSERT(empty());
} }
Rows_log_event *pending() const Rows_log_event *pending() const
...@@ -1377,8 +1378,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, ...@@ -1377,8 +1378,6 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT),
FLAGSTR(thd->options, OPTION_BEGIN))); FLAGSTR(thd->options, OPTION_BEGIN)));
thd->binlog_flush_pending_rows_event(TRUE);
/* /*
NULL denotes ROLLBACK with nothing to replicate: i.e., rollback of NULL denotes ROLLBACK with nothing to replicate: i.e., rollback of
only transactional tables. If the transaction contain changes to only transactional tables. If the transaction contain changes to
...@@ -1387,6 +1386,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, ...@@ -1387,6 +1386,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
*/ */
if (end_ev != NULL) if (end_ev != NULL)
{ {
thd->binlog_flush_pending_rows_event(TRUE);
/* /*
Doing a commit or a rollback including non-transactional tables, Doing a commit or a rollback including non-transactional tables,
i.e., ending a transaction where we might write the transaction i.e., ending a transaction where we might write the transaction
...@@ -1435,6 +1435,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data, ...@@ -1435,6 +1435,7 @@ binlog_end_trans(THD *thd, binlog_trx_data *trx_data,
mysql_bin_log.update_table_map_version(); mysql_bin_log.update_table_map_version();
} }
DBUG_ASSERT(thd->binlog_get_pending_rows_event() == NULL);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -1466,6 +1467,7 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all) ...@@ -1466,6 +1467,7 @@ static int binlog_prepare(handlerton *hton, THD *thd, bool all)
*/ */
static int binlog_commit(handlerton *hton, THD *thd, bool all) static int binlog_commit(handlerton *hton, THD *thd, bool all)
{ {
int error= 0;
DBUG_ENTER("binlog_commit"); DBUG_ENTER("binlog_commit");
binlog_trx_data *const trx_data= binlog_trx_data *const trx_data=
(binlog_trx_data*) thd_get_ha_data(thd, binlog_hton); (binlog_trx_data*) thd_get_ha_data(thd, binlog_hton);
...@@ -1499,10 +1501,14 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all) ...@@ -1499,10 +1501,14 @@ static int binlog_commit(handlerton *hton, THD *thd, bool all)
{ {
Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE); Query_log_event qev(thd, STRING_WITH_LEN("COMMIT"), TRUE, FALSE);
qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE) qev.error_code= 0; // see comment in MYSQL_LOG::write(THD, IO_CACHE)
int error= binlog_end_trans(thd, trx_data, &qev, all); error= binlog_end_trans(thd, trx_data, &qev, all);
DBUG_RETURN(error); goto end;
} }
DBUG_RETURN(0);
end:
if (!all)
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt commit
DBUG_RETURN(error);
} }
/** /**
...@@ -1562,6 +1568,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all) ...@@ -1562,6 +1568,8 @@ static int binlog_rollback(handlerton *hton, THD *thd, bool all)
*/ */
error= binlog_end_trans(thd, trx_data, 0, all); error= binlog_end_trans(thd, trx_data, 0, all);
} }
if (!all)
trx_data->before_stmt_pos = MY_OFF_T_UNDEF; // part of the stmt rollback
DBUG_RETURN(error); DBUG_RETURN(error);
} }
......
...@@ -13856,6 +13856,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) ...@@ -13856,6 +13856,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length=0; length=0;
for (i=0 ; i < table_count ; i++) for (i=0 ; i < table_count ; i++)
{ {
bool have_bit_fields= FALSE;
uint null_fields=0,used_fields; uint null_fields=0,used_fields;
Field **f_ptr,*field; Field **f_ptr,*field;
MY_BITMAP *read_set= tables[i].table->read_set; MY_BITMAP *read_set= tables[i].table->read_set;
...@@ -13870,13 +13871,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) ...@@ -13870,13 +13871,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length+=field->fill_cache_field(copy); length+=field->fill_cache_field(copy);
if (copy->blob_field) if (copy->blob_field)
(*blob_ptr++)=copy; (*blob_ptr++)=copy;
if (field->maybe_null()) if (field->real_maybe_null())
null_fields++; null_fields++;
if (field->type() == MYSQL_TYPE_BIT &&
((Field_bit*)field)->bit_len)
have_bit_fields= TRUE;
copy++; copy++;
} }
} }
/* Copy null bits from table */ /* Copy null bits from table */
if (null_fields && tables[i].table->s->null_fields) if (null_fields || have_bit_fields)
{ /* must copy null bits */ { /* must copy null bits */
copy->str= tables[i].table->null_flags; copy->str= tables[i].table->null_flags;
copy->length= tables[i].table->s->null_bytes; copy->length= tables[i].table->s->null_bytes;
......
...@@ -993,7 +993,7 @@ static bool get_field_default_value(THD *thd, TABLE *table, ...@@ -993,7 +993,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
{ {
bool has_default; bool has_default;
bool has_now_default; bool has_now_default;
enum enum_field_types field_type= field->type();
/* /*
We are using CURRENT_TIMESTAMP instead of NOW because it is We are using CURRENT_TIMESTAMP instead of NOW because it is
more standard more standard
...@@ -1001,7 +1001,7 @@ static bool get_field_default_value(THD *thd, TABLE *table, ...@@ -1001,7 +1001,7 @@ static bool get_field_default_value(THD *thd, TABLE *table,
has_now_default= table->timestamp_field == field && has_now_default= table->timestamp_field == field &&
field->unireg_check != Field::TIMESTAMP_UN_FIELD; field->unireg_check != Field::TIMESTAMP_UN_FIELD;
has_default= (field->type() != FIELD_TYPE_BLOB && has_default= (field_type != FIELD_TYPE_BLOB &&
!(field->flags & NO_DEFAULT_VALUE_FLAG) && !(field->flags & NO_DEFAULT_VALUE_FLAG) &&
field->unireg_check != Field::NEXT_NUMBER && field->unireg_check != Field::NEXT_NUMBER &&
!((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40))
...@@ -1016,7 +1016,19 @@ static bool get_field_default_value(THD *thd, TABLE *table, ...@@ -1016,7 +1016,19 @@ static bool get_field_default_value(THD *thd, TABLE *table,
{ // Not null by default { // Not null by default
char tmp[MAX_FIELD_WIDTH]; char tmp[MAX_FIELD_WIDTH];
String type(tmp, sizeof(tmp), field->charset()); String type(tmp, sizeof(tmp), field->charset());
field->val_str(&type); if (field_type == MYSQL_TYPE_BIT)
{
longlong dec= field->val_int();
char *ptr= longlong2str(dec, tmp + 2, 2);
uint32 length= (uint32) (ptr - tmp);
tmp[0]= 'b';
tmp[1]= '\'';
tmp[length]= '\'';
type.length(length + 1);
quoted= 0;
}
else
field->val_str(&type);
if (type.length()) if (type.length())
{ {
String def_val; String def_val;
......
...@@ -3111,10 +3111,12 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field) ...@@ -3111,10 +3111,12 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,
warn_buff); warn_buff);
} }
if ((sql_field->flags & BLOB_FLAG) && sql_field->length) if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
{ {
if (sql_field->sql_type == MYSQL_TYPE_BLOB) if (sql_field->sql_type == FIELD_TYPE_BLOB ||
sql_field->sql_type == FIELD_TYPE_TINY_BLOB ||
sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB)
{ {
/* The user has given a length to the blob column */ /* The user has given a length to the blob column */
sql_field->sql_type= get_blob_type_from_length(sql_field->length); sql_field->sql_type= get_blob_type_from_length(sql_field->length);
...@@ -4319,6 +4321,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -4319,6 +4321,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
table->table=0; // For query cache table->table=0; // For query cache
if (protocol->write()) if (protocol->write())
goto err; goto err;
thd->main_da.reset_diagnostics_area();
continue; continue;
/* purecov: end */ /* purecov: end */
} }
......
...@@ -161,11 +161,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b) ...@@ -161,11 +161,11 @@ static int FTB_WORD_cmp(my_off_t *v, FTB_WORD *a, FTB_WORD *b)
static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b) static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b)
{ {
/* ORDER BY word DESC, ndepth DESC */ /* ORDER BY word, ndepth */
int i= ha_compare_text(cs, (uchar*) (*b)->word+1,(*b)->len-1, int i= ha_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1,
(uchar*) (*a)->word+1,(*a)->len-1,0,0); (uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0);
if (!i) if (!i)
i=CMP_NUM((*b)->ndepth,(*a)->ndepth); i= CMP_NUM((*a)->ndepth, (*b)->ndepth);
return i; return i;
} }
...@@ -865,23 +865,49 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param, ...@@ -865,23 +865,49 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
FT_INFO *ftb= ftb_param->ftb; FT_INFO *ftb= ftb_param->ftb;
FTB_WORD *ftbw; FTB_WORD *ftbw;
int a, b, c; int a, b, c;
/*
Find right-most element in the array of query words matching this
word from a document.
*/
for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2) for (a= 0, b= ftb->queue.elements, c= (a+b)/2; b-a>1; c= (a+b)/2)
{ {
ftbw= ftb->list[c]; ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len, if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word+1, ftbw->len-1, (uchar*)ftbw->word+1, ftbw->len-1,
(my_bool)(ftbw->flags&FTB_FLAG_TRUNC), 0) > 0) (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0)
b= c; b= c;
else else
a= c; a= c;
} }
/*
If there were no words with truncation operator, we iterate to the
beginning of an array until array element is equal to the word from
a document. This is done mainly because the same word may be
mentioned twice (or more) in the query.
In case query has words with truncation operator we must iterate
to the beginning of the array. There may be non-matching query words
between matching word with truncation operator and the right-most
matching element. E.g., if we're looking for 'aaa15' in an array of
'aaa1* aaa14 aaa15 aaa16'.
Worse of that there still may be match even if the binary search
above didn't find matching element. E.g., if we're looking for
'aaa15' in an array of 'aaa1* aaa14 aaa16'. The binary search will
stop at 'aaa16'.
*/
for (; c >= 0; c--) for (; c >= 0; c--)
{ {
ftbw= ftb->list[c]; ftbw= ftb->list[c];
if (ha_compare_text(ftb->charset, (uchar*)word, len, if (ha_compare_text(ftb->charset, (uchar*)word, len,
(uchar*)ftbw->word + 1,ftbw->len - 1, (uchar*)ftbw->word + 1,ftbw->len - 1,
(my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0)) (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0))
break; {
if (ftb->with_scan & FTB_FLAG_TRUNC)
continue;
else
break;
}
if (ftbw->docid[1] == ftb->info->lastpos) if (ftbw->docid[1] == ftb->info->lastpos)
continue; continue;
ftbw->docid[1]= ftb->info->lastpos; ftbw->docid[1]= ftb->info->lastpos;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment