diff --git a/include/config-win.h b/include/config-win.h index bc2ae60f137..2e64e165630 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -15,6 +15,8 @@ /* Defines for Win32 to make it compatible for MySQL */ +#define BIG_TABLES + #ifdef __WIN2000__ /* We have to do this define before including windows.h to get the AWE API functions */ diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index a55e0f22a7c..e2a22303d9d 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -996,6 +996,29 @@ SELECT c,b FROM t1 GROUP BY c,b; DROP TABLE t1; +# +# Bug #31001: ORDER BY DESC in InnoDB not working +# +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB; +INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2); + +#The two queries below should produce different results, but they don't. +query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +query_vertical EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; + +query_vertical EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a ASC; +SELECT * FROM t1 ORDER BY b ASC, a ASC; +query_vertical EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a DESC; +SELECT * FROM t1 ORDER BY b DESC, a DESC; +query_vertical EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a DESC; +SELECT * FROM t1 ORDER BY b ASC, a DESC; +query_vertical EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a ASC; +SELECT * FROM t1 ORDER BY b DESC, a ASC; + +DROP TABLE t1; + --echo End of 5.0 tests # Fix for BUG#19243 "wrong LAST_INSERT_ID() after ON DUPLICATE KEY diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 7c0ac177cb5..68b636829fc 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -54,7 +54,7 @@ SHOW FULL COLUMNS FROM t1; Field Type Collation Null Key Default Extra Privileges Comment GROUP_ID int(10) unsigned NULL NO PRI 0 # LANG_ID smallint(5) unsigned NULL NO PRI 0 # -NAME char(80) latin1_swedish_ci NO MUL # +NAME char(80) latin1_swedish_ci NO MUL NULL # DROP TABLE t1; create table t1 (n int); insert into t1 values(9),(3),(12),(10); @@ -1125,7 +1125,7 @@ INDEX(`int_field`) ); DESCRIBE t1; Field Type Null Key Default Extra -int_field int(10) unsigned NO MUL +int_field int(10) unsigned NO MUL NULL char_field char(10) YES NULL SHOW INDEXES FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -1146,16 +1146,16 @@ unsigned_int_field char_field 5 pet DESCRIBE t2; Field Type Null Key Default Extra -unsigned_int_field int(10) unsigned NO MUL +unsigned_int_field int(10) unsigned NO MUL NULL char_field char(10) YES NULL DESCRIBE t2; Field Type Null Key Default Extra -unsigned_int_field int(10) unsigned NO MUL +unsigned_int_field int(10) unsigned NO MUL NULL char_field char(10) YES NULL ALTER TABLE t2 MODIFY unsigned_int_field BIGINT UNSIGNED NOT NULL; DESCRIBE t2; Field Type Null Key Default Extra -unsigned_int_field bigint(20) unsigned NO MUL +unsigned_int_field bigint(20) unsigned NO MUL NULL char_field char(10) YES NULL DROP TABLE t2; CREATE TABLE t1 (f1 INT, f2 INT, f3 INT); diff --git a/mysql-test/r/binlog_unsafe.result b/mysql-test/r/binlog_unsafe.result index fb89631f30b..281bb475944 100644 --- a/mysql-test/r/binlog_unsafe.result +++ b/mysql-test/r/binlog_unsafe.result @@ -5,9 +5,9 @@ CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY); CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3; INSERT INTO t1 SELECT UUID(); Warnings: -Warning 1590 Statement is not safe to log in statement format. +Warning 1591 Statement is not safe to log in statement format. SHOW WARNINGS; Level Warning -Code 1590 +Code 1591 Message Statement is not safe to log in statement format. DROP TABLE t1,t2,t3; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 84a620336dc..b370fbf6fbe 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -443,7 +443,7 @@ d date YES NULL e varchar(1) NO f datetime YES NULL g time YES NULL -h longblob NO +h longblob NO NULL dd time YES NULL select * from t2; a b c d e f g h dd diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index f476ec68371..026c0ebdcf2 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -488,7 +488,7 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 SHOW FIELDS FROM t1; Field Type Null Key Default Extra -latin1_f char(32) NO +latin1_f char(32) NO NULL ALTER TABLE t1 CHANGE latin1_f latin1_f CHAR(32) CHARACTER SET latin1 COLLATE latin1_bin; SHOW CREATE TABLE t1; diff --git a/mysql-test/r/ctype_recoding.result b/mysql-test/r/ctype_recoding.result index fe5842f9880..304e37facb1 100644 --- a/mysql-test/r/ctype_recoding.result +++ b/mysql-test/r/ctype_recoding.result @@ -54,7 +54,7 @@ Table Create Table ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='ËÏÍÍÅÎÔÁÒÉÊ ÔÁÂÌÉÃÙ' SHOW FIELDS FROM ÔÁÂÌÉÃÁ; Field Type Null Key Default Extra -ÐÏÌÅ char(32) NO +ÐÏÌÅ char(32) NO NULL SET CHARACTER SET cp1251; SHOW TABLES; Tables_in_test @@ -66,7 +66,7 @@ Table Create Table ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='êîììåíòàðèé òàáëèöû' SHOW FIELDS FROM òàáëèöà; Field Type Null Key Default Extra -ïîëå char(32) NO +ïîëå char(32) NO NULL SET CHARACTER SET utf8; SHOW TABLES; Tables_in_test @@ -78,7 +78,7 @@ Table Create Table ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы' SHOW FIELDS FROM таблица; Field Type Null Key Default Extra -поле char(32) NO +поле char(32) NO NULL SET CHARACTER SET koi8r; DROP TABLE ÔÁÂÌÉÃÁ; SET CHARACTER SET default; diff --git a/mysql-test/r/default.result b/mysql-test/r/default.result index cf9ef4f8f8b..e65e015eff9 100644 --- a/mysql-test/r/default.result +++ b/mysql-test/r/default.result @@ -115,7 +115,7 @@ Warning 1364 Field 'd' doesn't have a default value desc bug20691; Field Type Null Key Default Extra i int(11) YES NULL -d datetime NO +d datetime NO NULL dn datetime NO 0000-00-00 00:00:00 insert into bug20691 values (3, DEFAULT, DEFAULT), (3, '1975-07-10 07:10:03', '1978-01-13 14:08:51'), (3, DEFAULT, DEFAULT); Warnings: diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 2557fcb3b28..3c9e6384c64 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -31,7 +31,7 @@ create event e_55 on schedule at 10000101000000 do drop table t; ERROR HY000: Incorrect AT value: '10000101000000' create event e_55 on schedule at 20000101000000 do drop table t; Warnings: -Note 1586 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +Note 1587 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t; @@ -457,22 +457,22 @@ CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' DO SELECT 1; Warnings: -Note 1586 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +Note 1587 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' DISABLE DO SELECT 1; Warnings: -Note 1586 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +Note 1587 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DO SELECT 1; Warnings: -Note 1586 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +Note 1587 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. CREATE EVENT e4 ON SCHEDULE AT '1999-01-01 00:00:00' DISABLE DO SELECT 1; Warnings: -Note 1586 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. +Note 1587 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -482,19 +482,19 @@ The following should succeed giving a warning. ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE; Warnings: -Note 1542 Event execution time is in the past. Event has been disabled +Note 1543 Event execution time is in the past. Event has been disabled CREATE EVENT e4 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DO SELECT 1; Warnings: -Note 1542 Event execution time is in the past. Event has been disabled +Note 1543 Event execution time is in the past. Event has been disabled CREATE EVENT e5 ON SCHEDULE AT '1999-01-01 00:00:00' ON COMPLETION PRESERVE DO SELECT 1; Warnings: -Note 1542 Event execution time is in the past. Event has been disabled +Note 1543 Event execution time is in the past. Event has been disabled The following should succeed without warnings. ALTER EVENT e2 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'; ALTER EVENT e3 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result index dce08d3b9f9..984e22a2c1a 100644 --- a/mysql-test/r/events_trans.result +++ b/mysql-test/r/events_trans.result @@ -63,7 +63,7 @@ begin work; insert into t1 (a) values ("OK: create event if not exists"); create event if not exists e1 on schedule every 2 day do select 2; Warnings: -Note 1535 Event 'e1' already exists +Note 1536 Event 'e1' already exists rollback work; select * from t1; a diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index f68559fa8ea..7b4b02f3ff3 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -9,35 +9,35 @@ CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMET CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); SHOW FIELDS FROM gis_point; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g point YES NULL SHOW FIELDS FROM gis_line; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g linestring YES NULL SHOW FIELDS FROM gis_polygon; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g polygon YES NULL SHOW FIELDS FROM gis_multi_point; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g multipoint YES NULL SHOW FIELDS FROM gis_multi_line; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g multilinestring YES NULL SHOW FIELDS FROM gis_multi_polygon; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g multipolygon YES NULL SHOW FIELDS FROM gis_geometrycollection; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g geometrycollection YES NULL SHOW FIELDS FROM gis_geometry; Field Type Null Key Default Extra -fid int(11) NO PRI +fid int(11) NO PRI NULL g geometry YES NULL INSERT INTO gis_point VALUES (101, PointFromText('POINT(10 10)')), @@ -430,7 +430,7 @@ mln multilinestring YES NULL mpg multipolygon YES NULL gc geometrycollection YES NULL gm geometry YES NULL -fid int(11) NO +fid int(11) NO NULL DROP TABLE t1; SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))); AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index d0b6813cfd1..885acf5c744 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -1036,7 +1036,7 @@ b NULL use test; show columns from t1; Field Type Null Key Default Extra -a int(11) NO +a int(11) NO NULL b int(11) YES NULL drop table t1; CREATE TABLE t1 (a int); @@ -1434,6 +1434,37 @@ where event_object_table='t1'; trigger_name drop user mysqltest_1@localhost; drop database mysqltest; +create table t1 ( +f1 varchar(50), +f2 varchar(50) not null, +f3 varchar(50) default '', +f4 varchar(50) default NULL, +f5 bigint not null, +f6 bigint not null default 10, +f7 datetime not null, +f8 datetime default '2006-01-01' +); +select column_default from information_schema.columns where table_name= 't1'; +column_default +NULL +NULL + +NULL +NULL +10 +NULL +2006-01-01 00:00:00 +show columns from t1; +Field Type Null Key Default Extra +f1 varchar(50) YES NULL +f2 varchar(50) NO NULL +f3 varchar(50) YES +f4 varchar(50) YES NULL +f5 bigint(20) NO NULL +f6 bigint(20) NO 10 +f7 datetime NO NULL +f8 datetime YES 2006-01-01 00:00:00 +drop table t1; End of 5.0 tests. select * from information_schema.engines WHERE ENGINE="MyISAM"; ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 3293f05a1f9..0757936a8f7 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -1190,6 +1190,103 @@ c b 3 1 3 2 DROP TABLE t1; +CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), INDEX b (b)) ENGINE=InnoDB; +INSERT INTO t1(a,b) VALUES (1,1), (2,2), (3,2); +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys b +key b +key_len 5 +ref const +rows 1 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a ASC; +a b +2 2 +3 2 +EXPLAIN SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +id 1 +select_type SIMPLE +table t1 +type ref +possible_keys b +key b +key_len 5 +ref const +rows 1 +Extra Using where; Using index +SELECT * FROM t1 WHERE b=2 ORDER BY a DESC; +a b +3 2 +2 2 +EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a ASC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index +SELECT * FROM t1 ORDER BY b ASC, a ASC; +a b +1 1 +2 2 +3 2 +EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a DESC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index +SELECT * FROM t1 ORDER BY b DESC, a DESC; +a b +3 2 +2 2 +1 1 +EXPLAIN SELECT * FROM t1 ORDER BY b ASC, a DESC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index; Using filesort +SELECT * FROM t1 ORDER BY b ASC, a DESC; +a b +1 1 +3 2 +2 2 +EXPLAIN SELECT * FROM t1 ORDER BY b DESC, a ASC; +id 1 +select_type SIMPLE +table t1 +type index +possible_keys NULL +key b +key_len 5 +ref NULL +rows 3 +Extra Using index; Using filesort +SELECT * FROM t1 ORDER BY b DESC, a ASC; +a b +2 2 +3 2 +1 1 +DROP TABLE t1; End of 5.0 tests CREATE TABLE `t2` ( `k` int(11) NOT NULL auto_increment, diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index e348a387252..a2bed75a709 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -336,8 +336,8 @@ UNIQUE i1idx (i1), UNIQUE i2idx (i2)); desc t1; Field Type Null Key Default Extra -i1 int(11) NO PRI -i2 int(11) NO UNI +i1 int(11) NO PRI NULL +i2 int(11) NO UNI NULL show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -392,27 +392,27 @@ drop table t1; create table t1 (a int not null primary key, b varchar(20) not null unique); desc t1; Field Type Null Key Default Extra -a int(11) NO PRI -b varchar(20) NO UNI +a int(11) NO PRI NULL +b varchar(20) NO UNI NULL drop table t1; create table t1 (a int not null primary key, b int not null unique); desc t1; Field Type Null Key Default Extra -a int(11) NO PRI -b int(11) NO UNI +a int(11) NO PRI NULL +b int(11) NO UNI NULL drop table t1; create table t1 (a int not null primary key, b varchar(20) not null, unique (b(10))); desc t1; Field Type Null Key Default Extra -a int(11) NO PRI -b varchar(20) NO UNI +a int(11) NO PRI NULL +b varchar(20) NO UNI NULL drop table t1; create table t1 (a int not null primary key, b varchar(20) not null, c varchar(20) not null, unique(b(10),c(10))); desc t1; Field Type Null Key Default Extra -a int(11) NO PRI -b varchar(20) NO MUL -c varchar(20) NO +a int(11) NO PRI NULL +b varchar(20) NO MUL NULL +c varchar(20) NO NULL drop table t1; create table t1 ( c1 int, diff --git a/mysql-test/r/log_tables.result b/mysql-test/r/log_tables.result index 9e67d328849..5e18e1273c0 100644 --- a/mysql-test/r/log_tables.result +++ b/mysql-test/r/log_tables.result @@ -74,16 +74,16 @@ slow_log CREATE TABLE `slow_log` ( show fields from mysql.slow_log; Field Type Null Key Default Extra start_time timestamp NO CURRENT_TIMESTAMP -user_host mediumtext NO -query_time time NO -lock_time time NO -rows_sent int(11) NO -rows_examined int(11) NO +user_host mediumtext NO NULL +query_time time NO NULL +lock_time time NO NULL +rows_sent int(11) NO NULL +rows_examined int(11) NO NULL db varchar(512) YES NULL last_insert_id int(11) YES NULL insert_id int(11) YES NULL server_id int(11) YES NULL -sql_text mediumtext NO +sql_text mediumtext NO NULL flush logs; flush tables; SET GLOBAL GENERAL_LOG=ON; diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index df77bc99c22..4e39fb28454 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -91,7 +91,7 @@ i j k NULL 1 NULL Field Type Null Key Default Extra i int(11) YES NULL -j int(11) NO +j int(11) NO NULL k int(11) YES NULL +------+---+------+ | i | j | k | @@ -102,7 +102,7 @@ k int(11) YES NULL | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | i | int(11) | YES | | NULL | | -| j | int(11) | NO | | | | +| j | int(11) | NO | | NULL | | | k | int(11) | YES | | NULL | | +-------+---------+------+-----+---------+-------+ i s1 diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 9595676016c..396400f9010 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -911,3 +911,31 @@ explain partitions select * from t1 where a>-2 and a <=0; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p3 ALL NULL NULL NULL NULL 4 Using where drop table t1; +CREATE TABLE t1 ( recdate DATETIME NOT NULL ) +PARTITION BY RANGE( TO_DAYS(recdate) ) ( +PARTITION p0 VALUES LESS THAN ( TO_DAYS('2007-03-08') ), +PARTITION p1 VALUES LESS THAN ( TO_DAYS('2007-04-01') ) +); +INSERT INTO t1 VALUES ('2007-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2007-03-07 12:00:00'); +INSERT INTO t1 VALUES ('2007-03-08 12:00:00'); +INSERT INTO t1 VALUES ('2007-03-15 12:00:00'); +must use p0 only: +explain partitions select * from t1 where recdate < '2007-03-08 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where +drop table t1; +CREATE TABLE t1 ( recdate DATETIME NOT NULL ) +PARTITION BY RANGE( YEAR(recdate) ) ( +PARTITION p0 VALUES LESS THAN (2006), +PARTITION p1 VALUES LESS THAN (2007) +); +INSERT INTO t1 VALUES ('2005-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2005-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); +must use p0 only: +explain partitions select * from t1 where recdate < '2006-01-01 00:00:00'; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where +drop table t1; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index a532324719c..1c5f0e4dfd6 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -269,7 +269,7 @@ prepare stmt4 from ' show columns from t2 where field in (select ?) '; SET @arg00="a"; execute stmt4 using @arg00; Field Type Null Key Default Extra -a int(11) NO PRI +a int(11) NO PRI NULL SET @arg00="b"; execute stmt4 using @arg00; Field Type Null Key Default Extra @@ -280,7 +280,7 @@ Field Type Null Key Default Extra prepare stmt4 from ' show columns from t2 from test like ''a%'' '; execute stmt4; Field Type Null Key Default Extra -a int(11) NO PRI +a int(11) NO PRI NULL create index t2_idx on t2(b); prepare stmt4 from ' show index from t2 from test '; execute stmt4; @@ -389,7 +389,7 @@ drop database mysqltest ; prepare stmt3 from ' describe t2 '; execute stmt3; Field Type Null Key Default Extra -a int(11) NO PRI +a int(11) NO PRI NULL b char(10) YES MUL NULL drop table t2 ; execute stmt3; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 48e8bf933e1..ed61cfffa6b 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4047,4 +4047,55 @@ SHOW WARNINGS; Level Code Message Note 1003 select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0' DROP TABLE t1; +SELECT 1 AS ` `; + +1 +Warnings: +Warning 1474 Name ' ' has become '' +SELECT 1 AS ` `; + +1 +Warnings: +Warning 1474 Name ' ' has become '' +SELECT 1 AS ` x`; +x +1 +Warnings: +Warning 1466 Leading spaces are removed from name ' x' +CREATE VIEW v1 AS SELECT 1 AS ` `; +Warnings: +Warning 1474 Name ' ' has become '' +SELECT `` FROM v1; + +1 +CREATE VIEW v2 AS SELECT 1 AS ` `; +Warnings: +Warning 1474 Name ' ' has become '' +SELECT `` FROM v2; + +1 +CREATE VIEW v3 AS SELECT 1 AS ` x`; +Warnings: +Warning 1466 Leading spaces are removed from name ' x' +SELECT `x` FROM v3; +x +1 +DROP VIEW v1, v2, v3; End of 5.0 tests +create table t1(a INT, KEY (a)); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +SELECT a FROM t1 ORDER BY a LIMIT 2; +a +1 +2 +SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296; +a +3 +4 +5 +SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297; +a +3 +4 +5 +DROP TABLE t1; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 75585974a32..04a5253e6a8 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -228,7 +228,7 @@ show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment test_set set('val1','val2','val3') latin1_swedish_ci NO select,insert,update,references name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default -c int(11) NULL NO select,insert,update,references int column +c int(11) NULL NO NULL select,insert,update,references int column c-b int(11) NULL YES NULL select,insert,update,references name with a minus space 2 int(11) NULL YES NULL select,insert,update,references name with a space drop table t1; @@ -1000,7 +1000,7 @@ def COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 def COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33 def COLUMNS EXTRA Extra 253 60 0 N 1 0 33 Field Type Null Key Default Extra -c int(11) NO PRI +c int(11) NO PRI NULL ---------------------------------------------------------------- SHOW TRIGGERS LIKE 't1'; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 6c0bc930a8e..55b27b0a733 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2469,7 +2469,7 @@ Database (foo) Level Code Message Field Type Null Key Default Extra id char(16) NO -data int(11) NO +data int(11) NO NULL Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Database Table In_use Name_locked Privilege Context Comment @@ -2523,7 +2523,7 @@ Database (foo) Level Code Message Field Type Null Key Default Extra id char(16) NO -data int(11) NO +data int(11) NO NULL Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Database Table In_use Name_locked Privilege Context Comment @@ -5670,7 +5670,7 @@ drop function if exists pi; create function pi() returns varchar(50) return "pie, my favorite desert."; Warnings: -Note 1583 This function 'pi' has the same name as a native function +Note 1584 This function 'pi' has the same name as a native function SET @save_sql_mode=@@sql_mode; SET SQL_MODE='IGNORE_SPACE'; select pi(), pi (); @@ -5719,15 +5719,15 @@ use test; create function `database`() returns varchar(50) return "Stored function database"; Warnings: -Note 1583 This function 'database' has the same name as a native function +Note 1584 This function 'database' has the same name as a native function create function `current_user`() returns varchar(50) return "Stored function current_user"; Warnings: -Note 1583 This function 'current_user' has the same name as a native function +Note 1584 This function 'current_user' has the same name as a native function create function md5(x varchar(50)) returns varchar(50) return "Stored function md5"; Warnings: -Note 1583 This function 'md5' has the same name as a native function +Note 1584 This function 'md5' has the same name as a native function SET SQL_MODE='IGNORE_SPACE'; select database(), database (); database() database () diff --git a/mysql-test/r/sp_gis.result b/mysql-test/r/sp_gis.result index c640e5c46f2..b0960dec647 100644 --- a/mysql-test/r/sp_gis.result +++ b/mysql-test/r/sp_gis.result @@ -7,11 +7,11 @@ return 1; create function x() returns int return 2; Warnings: -Note 1583 This function 'x' has the same name as a native function +Note 1584 This function 'x' has the same name as a native function create function y() returns int return 3; Warnings: -Note 1583 This function 'y' has the same name as a native function +Note 1584 This function 'y' has the same name as a native function select a(); a() 1 diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result index 559fde80c12..dc8ab079ad8 100644 --- a/mysql-test/r/type_bit.result +++ b/mysql-test/r/type_bit.result @@ -657,6 +657,21 @@ b # # DROP TABLE t1; +CREATE TABLE t1 (a int, b bit(2)); +INSERT INTO t1 VALUES (3, 2), (2, 3), (2, 0), (3, 2), (3, 1); +SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a; +COUNT(DISTINCT b) +2 +2 +DROP TABLE t1; +create table t2 (a int, b bit(2), c char(10)); +INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'), +(3, 2, 'two'), (3, 1, 'one'); +SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a; +COUNT(DISTINCT b,c) +2 +2 +DROP TABLE t2; End of 5.0 tests create table t1(a bit(7)); insert into t1 values(0x40); diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index 051cfe61384..813f912c5af 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1675,7 +1675,7 @@ t1 CREATE TABLE `t1` ( show columns from t1; Field Type Null Key Default Extra a int(11) YES 1 -b enum('value','öäü_value','ÊÃÕ') NO +b enum('value','öäü_value','ÊÃÕ') NO NULL drop table t1; CREATE TABLE t1 (c enum('a', 'A') BINARY); INSERT INTO t1 VALUES ('a'),('A'); diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 22580c155f3..149f0d2dca5 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -63,9 +63,9 @@ time_field time NULL YES NULL # date_time datetime NULL YES NULL # blob_col blob NULL YES NULL # tinyblob_col tinyblob NULL YES NULL # -mediumblob_col mediumblob NULL NO # -longblob_col longblob NULL NO # -options enum('one','two','tree') latin1_swedish_ci NO MUL # +mediumblob_col mediumblob NULL NO NULL # +longblob_col longblob NULL NO NULL # +options enum('one','two','tree') latin1_swedish_ci NO MUL NULL # flags set('one','two','tree') latin1_swedish_ci NO # show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -214,7 +214,7 @@ Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned NULL NO MUL NULL auto_increment # string char(10) latin1_swedish_ci YES newdefault # tiny tinyint(4) NULL NO MUL 0 # -short smallint(6) NULL NO MUL # +short smallint(6) NULL NO MUL NULL # medium mediumint(8) NULL NO MUL 0 # long_int int(11) NULL NO 0 # longlong bigint(13) NULL NO MUL 0 # @@ -231,8 +231,8 @@ time_field time NULL YES NULL # date_time datetime NULL YES NULL # new_blob_col varchar(20) latin1_swedish_ci YES NULL # tinyblob_col tinyblob NULL YES NULL # -mediumblob_col mediumblob NULL NO # -options enum('one','two','tree') latin1_swedish_ci NO MUL # +mediumblob_col mediumblob NULL NO NULL # +options enum('one','two','tree') latin1_swedish_ci NO MUL NULL # flags set('one','two','tree') latin1_swedish_ci NO # new_field char(10) latin1_swedish_ci NO new # show full columns from t2; @@ -240,7 +240,7 @@ Field Type Collation Null Key Default Extra Privileges Comment auto int(5) unsigned NULL NO 0 # string char(10) latin1_swedish_ci YES newdefault # tiny tinyint(4) NULL NO 0 # -short smallint(6) NULL NO # +short smallint(6) NULL NO NULL # medium mediumint(8) NULL NO 0 # long_int int(11) NULL NO 0 # longlong bigint(13) NULL NO 0 # @@ -257,8 +257,8 @@ time_field time NULL YES NULL # date_time datetime NULL YES NULL # new_blob_col varchar(20) latin1_swedish_ci YES NULL # tinyblob_col tinyblob NULL YES NULL # -mediumblob_col mediumblob NULL NO # -options enum('one','two','tree') latin1_swedish_ci NO # +mediumblob_col mediumblob NULL NO NULL # +options enum('one','two','tree') latin1_swedish_ci NO NULL # flags set('one','two','tree') latin1_swedish_ci NO # new_field char(10) latin1_swedish_ci NO new # select t1.auto,t2.auto from t1,t2 where t1.auto=t2.auto and ((t1.string<>t2.string and (t1.string is not null or t2.string is not null)) or (t1.tiny<>t2.tiny and (t1.tiny is not null or t2.tiny is not null)) or (t1.short<>t2.short and (t1.short is not null or t2.short is not null)) or (t1.medium<>t2.medium and (t1.medium is not null or t2.medium is not null)) or (t1.long_int<>t2.long_int and (t1.long_int is not null or t2.long_int is not null)) or (t1.longlong<>t2.longlong and (t1.longlong is not null or t2.longlong is not null)) or (t1.real_float<>t2.real_float and (t1.real_float is not null or t2.real_float is not null)) or (t1.real_double<>t2.real_double and (t1.real_double is not null or t2.real_double is not null)) or (t1.utiny<>t2.utiny and (t1.utiny is not null or t2.utiny is not null)) or (t1.ushort<>t2.ushort and (t1.ushort is not null or t2.ushort is not null)) or (t1.umedium<>t2.umedium and (t1.umedium is not null or t2.umedium is not null)) or (t1.ulong<>t2.ulong and (t1.ulong is not null or t2.ulong is not null)) or (t1.ulonglong<>t2.ulonglong and (t1.ulonglong is not null or t2.ulonglong is not null)) or (t1.time_stamp<>t2.time_stamp and (t1.time_stamp is not null or t2.time_stamp is not null)) or (t1.date_field<>t2.date_field and (t1.date_field is not null or t2.date_field is not null)) or (t1.time_field<>t2.time_field and (t1.time_field is not null or t2.time_field is not null)) or (t1.date_time<>t2.date_time and (t1.date_time is not null or t2.date_time is not null)) or (t1.new_blob_col<>t2.new_blob_col and (t1.new_blob_col is not null or t2.new_blob_col is not null)) or (t1.tinyblob_col<>t2.tinyblob_col and (t1.tinyblob_col is not null or t2.tinyblob_col is not null)) or (t1.mediumblob_col<>t2.mediumblob_col and (t1.mediumblob_col is not null or t2.mediumblob_col is not null)) or (t1.options<>t2.options and (t1.options is not null or t2.options is not null)) or (t1.flags<>t2.flags and (t1.flags is not null or t2.flags is not null)) or (t1.new_field<>t2.new_field and (t1.new_field is not null or t2.new_field is not null))); @@ -276,8 +276,8 @@ t1 int(1) NULL NO 0 # t2 varchar(1) latin1_swedish_ci NO # t3 varchar(256) latin1_swedish_ci NO # t4 varbinary(256) NULL NO # -t5 longtext latin1_swedish_ci NO # -t6 longblob NULL NO # +t5 longtext latin1_swedish_ci NO NULL # +t6 longblob NULL NO NULL # t7 char(0) latin1_swedish_ci NO # t8 binary(0) NULL NO # select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2; diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index aac7c4e850a..a1f2c80e766 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -647,32 +647,32 @@ select extractValue('a','/a'); extractValue('a','/a') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 5: unexpected END-OF-INPUT' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 5: unexpected END-OF-INPUT' select extractValue('a<','/a'); extractValue('a<','/a') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 6: END-OF-INPUT unexpected (ident or '/' wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 6: END-OF-INPUT unexpected (ident or '/' wanted)' select extractValue('aaaa' wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 8: END-OF-INPUT unexpected ('>' wanted)' select extractValue('a','/a'); extractValue('a','/a') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 12: '' unexpected (END-OF-INPUT wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 12: '' unexpected (END-OF-INPUT wanted)' select extractValue('a','/a'); extractValue('a','/a') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 7: '>' unexpected (ident or string wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 7: '>' unexpected (ident or string wanted)' select extractValue('1','position()'); ERROR HY000: XPATH syntax error: '' select extractValue('1','last()'); @@ -723,17 +723,17 @@ select extractValue('<01>10:39:15<02>140','//* extractValue('<01>10:39:15<02>140','//*') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 13: unknown token unexpected (ident or '/' wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 13: unknown token unexpected (ident or '/' wanted)' select extractValue('<.>test','//*'); extractValue('<.>test','//*') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)' select extractValue('<->test','//*'); extractValue('<->test','//*') NULL Warnings: -Warning 1523 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)' +Warning 1524 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)' select extractValue('<:>test','//*'); extractValue('<:>test','//*') test diff --git a/mysql-test/suite/ndb/r/ndb_dd_basic.result b/mysql-test/suite/ndb/r/ndb_dd_basic.result index d92e71d8221..0ff28f889b7 100644 --- a/mysql-test/suite/ndb/r/ndb_dd_basic.result +++ b/mysql-test/suite/ndb/r/ndb_dd_basic.result @@ -8,20 +8,20 @@ INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M ENGINE=MYISAM; Warnings: -Error 1476 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +Error 1477 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undofile02.dat' INITIAL_SIZE = 4M ENGINE=XYZ; Warnings: Warning 1286 Unknown table engine 'XYZ' -Error 1476 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +Error 1477 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M; Warnings: -Error 1476 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' +Error 1477 Table storage engine 'MyISAM' does not support the create option 'TABLESPACE or LOGFILE GROUP' set storage_engine=ndb; CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' diff --git a/mysql-test/suite/ndb/r/ndb_dd_ddl.result b/mysql-test/suite/ndb/r/ndb_dd_ddl.result index d065edfee5d..569769cfaef 100644 --- a/mysql-test/suite/ndb/r/ndb_dd_ddl.result +++ b/mysql-test/suite/ndb/r/ndb_dd_ddl.result @@ -16,7 +16,7 @@ ERROR HY000: Failed to create LOGFILE GROUP SHOW WARNINGS; Level Code Message Error 1296 Got error 1514 'Currently there is a limit of one logfile group' from NDB -Error 1526 Failed to create LOGFILE GROUP +Error 1527 Failed to create LOGFILE GROUP CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' INITIAL_SIZE 1M diff --git a/mysql-test/suite/ndb/r/ndb_gis.result b/mysql-test/suite/ndb/r/ndb_gis.result index 1d593f471d1..b401dee8054 100644 --- a/mysql-test/suite/ndb/r/ndb_gis.result +++ b/mysql-test/suite/ndb/r/ndb_gis.result @@ -463,7 +463,7 @@ drop table t1; End of 4.1 tests CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); Warnings: -Error 1476 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' +Error 1477 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); @@ -1013,7 +1013,7 @@ drop table t1; End of 4.1 tests CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY); Warnings: -Error 1476 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' +Error 1477 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK' INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))')); INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))')); INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))')); diff --git a/mysql-test/suite/ndb/r/ndb_row_format.result b/mysql-test/suite/ndb/r/ndb_row_format.result index 44880e28c83..ea495e7e9c5 100644 --- a/mysql-test/suite/ndb/r/ndb_row_format.result +++ b/mysql-test/suite/ndb/r/ndb_row_format.result @@ -8,7 +8,7 @@ ENGINE=NDB; ERROR HY000: Can't create table 'test.t1' (errno: 138) SHOW WARNINGS; Level Code Message -Error 1476 Table storage engine 'ndbcluster' does not support the create option 'Row format FIXED incompatible with variable sized attribute' +Error 1477 Table storage engine 'ndbcluster' does not support the create option 'Row format FIXED incompatible with variable sized attribute' Error 1005 Can't create table 'test.t1' (errno: 138) CREATE TABLE t1 ( a INT KEY, diff --git a/mysql-test/suite/ndb/r/ndb_single_user.result b/mysql-test/suite/ndb/r/ndb_single_user.result index 11e8f098416..552629ae532 100644 --- a/mysql-test/suite/ndb/r/ndb_single_user.result +++ b/mysql-test/suite/ndb/r/ndb_single_user.result @@ -11,7 +11,7 @@ ERROR HY000: Failed to create LOGFILE GROUP show warnings; Level Code Message Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB -Error 1526 Failed to create LOGFILE GROUP +Error 1527 Failed to create LOGFILE GROUP create table t1 (a int key, b int unique, c int) engine ndb; CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' @@ -27,14 +27,14 @@ ERROR HY000: Failed to create TABLESPACE show warnings; Level Code Message Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB -Error 1526 Failed to create TABLESPACE +Error 1527 Failed to create TABLESPACE DROP LOGFILE GROUP lg1 ENGINE =NDB; ERROR HY000: Failed to drop LOGFILE GROUP show warnings; Level Code Message Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB -Error 1527 Failed to drop LOGFILE GROUP +Error 1528 Failed to drop LOGFILE GROUP CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 @@ -47,7 +47,7 @@ ERROR HY000: Failed to alter: DROP DATAFILE show warnings; Level Code Message Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB -Error 1531 Failed to alter: DROP DATAFILE +Error 1532 Failed to alter: DROP DATAFILE ALTER TABLESPACE ts1 DROP DATAFILE 'datafile.dat' ENGINE NDB; @@ -57,7 +57,7 @@ ERROR HY000: Failed to drop TABLESPACE show warnings; Level Code Message Error 1296 Got error 299 'Operation not allowed or aborted due to single user mode' from NDB -Error 1527 Failed to drop TABLESPACE +Error 1528 Failed to drop TABLESPACE DROP TABLESPACE ts1 ENGINE NDB; DROP LOGFILE GROUP lg1 diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result index d3922ed42db..fe5a5b28682 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result @@ -72,7 +72,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -90,7 +90,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. STOP SLAVE; RESET SLAVE; @@ -139,7 +139,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -157,7 +157,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -201,7 +201,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -219,7 +219,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -263,7 +263,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 Skip_Counter 0 Exec_Master_Log_Pos # @@ -281,7 +281,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -324,7 +324,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -342,7 +342,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** @@ -436,7 +436,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 Skip_Counter 0 Exec_Master_Log_Pos # @@ -454,7 +454,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -497,7 +497,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 Skip_Counter 0 Exec_Master_Log_Pos # @@ -515,7 +515,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -822,7 +822,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 Skip_Counter 0 Exec_Master_Log_Pos # @@ -840,7 +840,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result index c41e2759a8c..e70a2efaf29 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result @@ -72,7 +72,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -90,7 +90,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. STOP SLAVE; RESET SLAVE; @@ -139,7 +139,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -157,7 +157,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -201,7 +201,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -219,7 +219,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -263,7 +263,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 Skip_Counter 0 Exec_Master_Log_Pos # @@ -281,7 +281,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -324,7 +324,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -342,7 +342,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** @@ -436,7 +436,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 Skip_Counter 0 Exec_Master_Log_Pos # @@ -454,7 +454,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -497,7 +497,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 Skip_Counter 0 Exec_Master_Log_Pos # @@ -515,7 +515,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -822,7 +822,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 Skip_Counter 0 Exec_Master_Log_Pos # @@ -840,7 +840,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index c3cec758d89..568078cc276 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -44,7 +44,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1588 +Last_Errno 1589 Last_Error The incident LOST_EVENTS occured on the master. Message: Skip_Counter 0 Exec_Master_Log_Pos # @@ -62,7 +62,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1588 +Last_SQL_Errno 1589 Last_SQL_Error The incident LOST_EVENTS occured on the master. Message: SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result index 0216ef65570..d30110f85e9 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result @@ -65,7 +65,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1591 +Last_Errno 1592 Last_Error Fatal error: Not enough memory Skip_Counter 0 Exec_Master_Log_Pos 325 @@ -83,7 +83,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1591 +Last_SQL_Errno 1592 Last_SQL_Error Fatal error: Not enough memory SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result index 166dcf79ee3..9358e36cac6 100644 --- a/mysql-test/suite/rpl/r/rpl_row_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result @@ -37,7 +37,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -55,7 +55,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -91,7 +91,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -109,7 +109,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -145,7 +145,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -163,7 +163,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -200,7 +200,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -218,7 +218,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4 SELECT COUNT(*) FROM t1; COUNT(*) @@ -255,7 +255,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -273,7 +273,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -309,7 +309,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -327,7 +327,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -364,7 +364,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -382,7 +382,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -419,7 +419,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -437,7 +437,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -505,7 +505,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -523,7 +523,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -560,7 +560,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -578,7 +578,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -614,7 +614,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -632,7 +632,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -668,7 +668,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -686,7 +686,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) @@ -723,7 +723,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -741,7 +741,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index 07ac657584c..566537ab745 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -214,7 +214,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -232,7 +232,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -257,7 +257,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -275,7 +275,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -300,7 +300,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -318,7 +318,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index a17d495a116..83df75b81e9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -214,7 +214,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -232,7 +232,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 3, test.t4 has type 4 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -257,7 +257,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -275,7 +275,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 1 type mismatch - received type 3, test.t5 has type 4 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -300,7 +300,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 Skip_Counter 0 Exec_Master_Log_Pos # @@ -318,7 +318,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno 0 Last_IO_Error -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 3, test.t6 has type 4 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_udf.result b/mysql-test/suite/rpl/r/rpl_udf.result index 49f8256ce96..fcd2f4743ba 100644 --- a/mysql-test/suite/rpl/r/rpl_udf.result +++ b/mysql-test/suite/rpl/r/rpl_udf.result @@ -182,19 +182,19 @@ CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; affected rows: 0 INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); Warnings: -Warning 1590 Statement is not safe to log in statement format. +Warning 1591 Statement is not safe to log in statement format. affected rows: 1 INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); Warnings: -Warning 1590 Statement is not safe to log in statement format. +Warning 1591 Statement is not safe to log in statement format. affected rows: 1 INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); Warnings: -Warning 1590 Statement is not safe to log in statement format. +Warning 1591 Statement is not safe to log in statement format. affected rows: 1 INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); Warnings: -Warning 1590 Statement is not safe to log in statement format. +Warning 1591 Statement is not safe to log in statement format. affected rows: 1 SELECT * FROM t1 ORDER BY sum; sum price diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result index 2327dc7ee81..41e888827b1 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -72,7 +72,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. Skip_Counter 0 Exec_Master_Log_Pos # @@ -90,7 +90,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. STOP SLAVE; RESET SLAVE; @@ -139,7 +139,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -157,7 +157,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -201,7 +201,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -219,7 +219,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -263,7 +263,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 Skip_Counter 0 Exec_Master_Log_Pos # @@ -281,7 +281,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -324,7 +324,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 Skip_Counter 0 Exec_Master_Log_Pos # @@ -342,7 +342,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** @@ -436,7 +436,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 Skip_Counter 0 Exec_Master_Log_Pos # @@ -454,7 +454,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -497,7 +497,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 Skip_Counter 0 Exec_Master_Log_Pos # @@ -515,7 +515,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -823,7 +823,7 @@ Replicate_Do_Table Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1533 +Last_Errno 1534 Last_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 Skip_Counter 0 Exec_Master_Log_Pos # @@ -841,7 +841,7 @@ Seconds_Behind_Master # Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # -Last_SQL_Errno 1533 +Last_SQL_Errno 1534 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 8a3d62ba91f..6bcc14d4e49 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -1072,6 +1072,23 @@ connection default; drop user mysqltest_1@localhost; drop database mysqltest; +# +# Bug#27747 database metadata doesn't return sufficient column default info +# +create table t1 ( + f1 varchar(50), + f2 varchar(50) not null, + f3 varchar(50) default '', + f4 varchar(50) default NULL, + f5 bigint not null, + f6 bigint not null default 10, + f7 datetime not null, + f8 datetime default '2006-01-01' +); +select column_default from information_schema.columns where table_name= 't1'; +show columns from t1; +drop table t1; + --echo End of 5.0 tests. # # Show engines diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 12951c9232a..31008d2b011 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -761,3 +761,34 @@ insert into t1 values (-15),(-5),(5),(15),(-15),(-5),(5),(15); explain partitions select * from t1 where a>-2 and a <=0; drop table t1; + +# +# BUG#27927 Partition pruning not optimal with TO_DAYS function +# + +CREATE TABLE t1 ( recdate DATETIME NOT NULL ) +PARTITION BY RANGE( TO_DAYS(recdate) ) ( + PARTITION p0 VALUES LESS THAN ( TO_DAYS('2007-03-08') ), + PARTITION p1 VALUES LESS THAN ( TO_DAYS('2007-04-01') ) +); +INSERT INTO t1 VALUES ('2007-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2007-03-07 12:00:00'); +INSERT INTO t1 VALUES ('2007-03-08 12:00:00'); +INSERT INTO t1 VALUES ('2007-03-15 12:00:00'); +-- echo must use p0 only: +explain partitions select * from t1 where recdate < '2007-03-08 00:00:00'; + +drop table t1; +CREATE TABLE t1 ( recdate DATETIME NOT NULL ) +PARTITION BY RANGE( YEAR(recdate) ) ( + PARTITION p0 VALUES LESS THAN (2006), + PARTITION p1 VALUES LESS THAN (2007) +); +INSERT INTO t1 VALUES ('2005-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2005-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); +INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); + +-- echo must use p0 only: +explain partitions select * from t1 where recdate < '2006-01-01 00:00:00'; +drop table t1; diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 3f17eb92d40..76a66cc4783 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -3449,4 +3449,38 @@ SHOW WARNINGS; DROP TABLE t1; +# +# Bug #27695: Misleading warning when declaring all space column names and +# truncation of one-space column names to zero length names. +# + +--disable_ps_protocol + +SELECT 1 AS ` `; +SELECT 1 AS ` `; +SELECT 1 AS ` x`; + +CREATE VIEW v1 AS SELECT 1 AS ` `; +SELECT `` FROM v1; + +CREATE VIEW v2 AS SELECT 1 AS ` `; +SELECT `` FROM v2; + +CREATE VIEW v3 AS SELECT 1 AS ` x`; +SELECT `x` FROM v3; + +DROP VIEW v1, v2, v3; + +--enable_ps_protocol + --echo End of 5.0 tests + +# +# Bug #30639: limit offset,rowcount wraps when rowcount >= 2^32 in windows +# +create table t1(a INT, KEY (a)); +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); +SELECT a FROM t1 ORDER BY a LIMIT 2; +SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296; +SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297; +DROP TABLE t1; diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test index 2a6e36011a6..b9d93c28115 100644 --- a/mysql-test/t/type_bit.test +++ b/mysql-test/t/type_bit.test @@ -304,6 +304,20 @@ SELECT b FROM t1 GROUP BY b; --disable_metadata DROP TABLE t1; +# +# BUG#30324 Wrong query result for COUNT(DISTINCT(bit_column)) +# +CREATE TABLE t1 (a int, b bit(2)); +INSERT INTO t1 VALUES (3, 2), (2, 3), (2, 0), (3, 2), (3, 1); +SELECT COUNT(DISTINCT b) FROM t1 GROUP BY a; +DROP TABLE t1; + +create table t2 (a int, b bit(2), c char(10)); +INSERT INTO t2 VALUES (3, 2, 'two'), (2, 3, 'three'), (2, 0, 'zero'), + (3, 2, 'two'), (3, 1, 'one'); +SELECT COUNT(DISTINCT b,c) FROM t2 GROUP BY a; +DROP TABLE t2; + --echo End of 5.0 tests # diff --git a/sql/item.cc b/sql/item.cc index d98a37e3c32..d8080d62c39 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -715,10 +715,16 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs) str++; } if (orig_len != length && !is_autogenerated_name) - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES), - str + length - orig_len); - + { + if (length == 0) + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NAME_BECOMES_EMPTY, ER(ER_NAME_BECOMES_EMPTY), + str + length - orig_len); + else + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES), + str + length - orig_len); + } } if (!my_charset_same(cs, system_charset_info)) { @@ -2069,6 +2075,11 @@ Item *Item_field::get_tmp_table_item(THD *thd) return new_item; } +longlong Item_field::val_int_endpoint(bool left_endp, bool *incl_endp) +{ + longlong res= val_int(); + return null_value? LONGLONG_MIN : res; +} /* Create an item from a string we KNOW points to a valid longlong diff --git a/sql/item.h b/sql/item.h index 21c4560c6bc..655159ab752 100644 --- a/sql/item.h +++ b/sql/item.h @@ -569,6 +569,43 @@ public: virtual enum_monotonicity_info get_monotonicity_info() const { return NON_MONOTONIC; } + /* + Convert "func_arg $CMP$ const" half-interval into "FUNC(func_arg) $CMP2$ const2" + + SYNOPSIS + val_int_endpoint() + left_endp FALSE <=> The interval is "x < const" or "x <= const" + TRUE <=> The interval is "x > const" or "x >= const" + + incl_endp IN TRUE <=> the comparison is '<' or '>' + FALSE <=> the comparison is '<=' or '>=' + OUT The same but for the "F(x) $CMP$ F(const)" comparison + + DESCRIPTION + This function is defined only for unary monotonic functions. The caller + supplies the source half-interval + + x $CMP$ const + + The value of const is supplied implicitly as the value this item's + argument, the form of $CMP$ comparison is specified through the + function's arguments. The calle returns the result interval + + F(x) $CMP2$ F(const) + + passing back F(const) as the return value, and the form of $CMP2$ + through the out parameter. NULL values are assumed to be comparable and + be less than any non-NULL values. + + RETURN + The output range bound, which equal to the value of val_int() + - If the value of the function is NULL then the bound is the + smallest possible value of LONGLONG_MIN + */ + virtual longlong val_int_endpoint(bool left_endp, bool *incl_endp) + { DBUG_ASSERT(0); return 0; } + + /* valXXX methods must return NULL or 0 or 0.0 if null_value is set. */ /* Return double precision floating point representation of item. @@ -1401,6 +1438,7 @@ public: { return MONOTONIC_STRICT_INCREASING; } + longlong val_int_endpoint(bool left_endp, bool *incl_endp); Field *get_tmp_table_field() { return result_field; } Field *tmp_table_field(TABLE *t_arg) { return result_field; } bool get_date(MYSQL_TIME *ltime,uint fuzzydate); diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 8fe843a2a2d..2684cce16ac 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2483,6 +2483,23 @@ bool Item_sum_count_distinct::setup(THD *thd) count_field_types(select_lex, tmp_table_param, list, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); + /* + Make create_tmp_table() convert BIT columns to BIGINT. + This is needed because BIT fields store parts of their data in table's + null bits, and we don't have methods to compare two table records, which + is needed by Unique which is used when HEAP table is used. + */ + { + List_iterator_fast li(list); + Item *item; + while ((item= li++)) + { + if (item->type() == Item::FIELD_ITEM && + ((Item_field*)item)->field->type() == FIELD_TYPE_BIT) + item->marker=4; + } + } + if (!(table= create_tmp_table(thd, tmp_table_param, list, (ORDER*) 0, 1, 0, (select_lex->options | thd->options), diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 2fedb4b72b6..300d0788f55 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -962,6 +962,44 @@ enum_monotonicity_info Item_func_to_days::get_monotonicity_info() const } +longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp) +{ + DBUG_ASSERT(fixed == 1); + MYSQL_TIME ltime; + longlong res; + if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + { + /* got NULL, leave the incl_endp intact */ + return LONGLONG_MIN; + } + res=(longlong) calc_daynr(ltime.year,ltime.month,ltime.day); + + if (args[0]->field_type() == MYSQL_TYPE_DATE) + { + // TO_DAYS() is strictly monotonic for dates, leave incl_endp intact + return res; + } + + /* + Handle the special but practically useful case of datetime values that + point to day bound ("strictly less" comparison stays intact): + + col < '2007-09-15 00:00:00' -> TO_DAYS(col) < TO_DAYS('2007-09-15') + + which is different from the general case ("strictly less" changes to + "less or equal"): + + col < '2007-09-15 12:34:56' -> TO_DAYS(col) <= TO_DAYS('2007-09-15') + */ + if (!left_endp && !(ltime.hour || ltime.minute || ltime.second || + ltime.second_part)) + ; /* do nothing */ + else + *incl_endp= TRUE; + return res; +} + + longlong Item_func_dayofyear::val_int() { DBUG_ASSERT(fixed == 1); @@ -1152,7 +1190,7 @@ longlong Item_func_year::val_int() Get information about this Item tree monotonicity SYNOPSIS - Item_func_to_days::get_monotonicity_info() + Item_func_year::get_monotonicity_info() DESCRIPTION Get information about monotonicity of the function represented by this item @@ -1171,6 +1209,37 @@ enum_monotonicity_info Item_func_year::get_monotonicity_info() const return NON_MONOTONIC; } + +longlong Item_func_year::val_int_endpoint(bool left_endp, bool *incl_endp) +{ + DBUG_ASSERT(fixed == 1); + MYSQL_TIME ltime; + if (get_arg0_date(<ime, TIME_FUZZY_DATE)) + { + /* got NULL, leave the incl_endp intact */ + return LONGLONG_MIN; + } + + /* + Handle the special but practically useful case of datetime values that + point to year bound ("strictly less" comparison stays intact) : + + col < '2007-01-01 00:00:00' -> YEAR(col) < 2007 + + which is different from the general case ("strictly less" changes to + "less or equal"): + + col < '2007-09-15 23:00:00' -> YEAR(col) <= 2007 + */ + if (!left_endp && ltime.day == 1 && ltime.month == 1 && + !(ltime.hour || ltime.minute || ltime.second || ltime.second_part)) + ; /* do nothing */ + else + *incl_endp= TRUE; + return ltime.year; +} + + longlong Item_func_unix_timestamp::val_int() { MYSQL_TIME ltime; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 32f5bcf8e52..36556269d07 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -68,6 +68,7 @@ public: maybe_null=1; } enum_monotonicity_info get_monotonicity_info() const; + longlong val_int_endpoint(bool left_endp, bool *incl_endp); bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; @@ -248,6 +249,7 @@ public: longlong val_int(); const char *func_name() const { return "year"; } enum_monotonicity_info get_monotonicity_info() const; + longlong val_int_endpoint(bool left_endp, bool *incl_endp); void fix_length_and_dec() { decimals=0; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d12c086935c..5a772501e48 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3506,7 +3506,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records) if (param->table->file->primary_key_is_clustered()) { result= param->table->file->read_time(param->table->s->primary_key, - records, records); + (uint)records, records); } else { @@ -3715,7 +3715,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, /* Add Unique operations cost */ unique_calc_buff_size= - Unique::get_cost_calc_buff_size(non_cpk_scan_records, + Unique::get_cost_calc_buff_size((ulong)non_cpk_scan_records, param->table->file->ref_length, param->thd->variables.sortbuff_size); if (param->imerge_cost_buff_size < unique_calc_buff_size) @@ -3727,7 +3727,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, } imerge_cost += - Unique::get_use_cost(param->imerge_cost_buff, non_cpk_scan_records, + Unique::get_use_cost(param->imerge_cost_buff, (uint)non_cpk_scan_records, param->table->file->ref_length, param->thd->variables.sortbuff_size); DBUG_PRINT("info",("index_merge total cost: %g (wanted: less then %g)", @@ -4067,7 +4067,7 @@ ROR_INTERSECT_INFO* ror_intersect_init(const PARAM *param) info->is_covering= FALSE; info->index_scan_costs= 0.0; info->index_records= 0; - info->out_rows= param->table->file->stats.records; + info->out_rows= (double) param->table->file->stats.records; bitmap_clear_all(&info->covered_fields); return info; } @@ -8196,7 +8196,7 @@ int QUICK_RANGE_SELECT::reset() if (file->ha_table_flags() & HA_NEED_READ_RANGE_BUFFER) { mrange_bufsiz= min(multi_range_bufsiz, - (QUICK_SELECT_I::records + 1)* head->s->reclength); + ((uint)QUICK_SELECT_I::records + 1)* head->s->reclength); while (mrange_bufsiz && ! my_multi_malloc(MYF(MY_WME), @@ -9822,7 +9822,7 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, bool have_min, bool have_max, double *read_cost, ha_rows *records) { - uint table_records; + ha_rows table_records; uint num_groups; uint num_blocks; uint keys_per_block; @@ -9839,14 +9839,14 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, keys_per_block= (table->file->stats.block_size / 2 / (index_info->key_length + table->file->ref_length) + 1); - num_blocks= (table_records / keys_per_block) + 1; + num_blocks= (uint)(table_records / keys_per_block) + 1; /* Compute the number of keys in a group. */ keys_per_group= index_info->rec_per_key[group_key_parts - 1]; if (keys_per_group == 0) /* If there is no statistics try to guess */ /* each group contains 10% of all records */ - keys_per_group= (table_records / 10) + 1; - num_groups= (table_records / keys_per_group) + 1; + keys_per_group= (uint)(table_records / 10) + 1; + num_groups= (uint)(table_records / keys_per_group) + 1; /* Apply the selectivity of the quick select for group prefixes. */ if (range_tree && (quick_prefix_records != HA_POS_ERROR)) @@ -9890,9 +9890,9 @@ void cost_group_min_max(TABLE* table, KEY *index_info, uint used_key_parts, *records= num_groups; DBUG_PRINT("info", - ("table rows: %u keys/block: %u keys/group: %u result rows: %lu blocks: %u", - table_records, keys_per_block, keys_per_group, (ulong) *records, - num_blocks)); + ("table rows: %lu keys/block: %u keys/group: %u result rows: %lu blocks: %u", + (ulong)table_records, keys_per_block, keys_per_group, + (ulong) *records, num_blocks)); DBUG_VOID_RETURN; } diff --git a/sql/partition_info.h b/sql/partition_info.h index 10edea074c0..b7d13e188f3 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -139,20 +139,6 @@ public: */ get_partitions_in_range_iter get_subpart_iter_for_interval; - /* - Valid iff - get_part_iter_for_interval=get_part_iter_for_interval_via_walking: - controls how we'll process "field < C" and "field > C" intervals. - If the partitioning function F is strictly increasing, then for any x, y - "x < y" => "F(x) < F(y)" (*), i.e. when we get interval "field < C" - we can perform partition pruning on the equivalent "F(field) < F(C)". - - If the partitioning function not strictly increasing (it is simply - increasing), then instead of (*) we get "x < y" => "F(x) <= F(y)" - i.e. for interval "field < C" we can perform partition pruning for - "F(field) <= F(C)". - */ - bool range_analysis_include_bounds; /******************************************** * INTERVAL ANALYSIS ENDS ********************************************/ diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 8ecba1d4be0..30cf85f3181 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -5656,6 +5656,8 @@ ER_ADMIN_WRONG_MRG_TABLE eng "Table '%-.64s' is differently defined or of non-MyISAM type or doesn't exist" ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT eng "Too high level of nesting for select" +ER_NAME_BECOMES_EMPTY + eng "Name '%-.64s' has become ''" ER_FOREIGN_SERVER_EXISTS eng "The foreign server, %s, you are trying to create already exists." ER_FOREIGN_SERVER_DOESNT_EXIST diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6b94505e46e..0a5f83af400 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2397,10 +2397,19 @@ st_lex::copy_db_to(char **p_db, size_t *p_db_length) const void st_select_lex_unit::set_limit(st_select_lex *sl) { ha_rows select_limit_val; + ulonglong val; DBUG_ASSERT(! thd->stmt_arena->is_stmt_prepare()); - select_limit_val= (ha_rows)(sl->select_limit ? sl->select_limit->val_uint() : - HA_POS_ERROR); + val= sl->select_limit ? sl->select_limit->val_uint() : HA_POS_ERROR; + select_limit_val= (ha_rows)val; +#ifndef BIG_TABLES + /* + Check for overflow : ha_rows can be smaller then ulonglong if + BIG_TABLES is off. + */ + if (val != (ulonglong)select_limit_val) + select_limit_val= HA_POS_ERROR; +#endif offset_limit_cnt= (ha_rows)(sl->offset_limit ? sl->offset_limit->val_uint() : ULL(0)); select_limit_cnt= select_limit_val + offset_limit_cnt; diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 7b707f813fc..55f9b08d3fe 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -37,7 +37,7 @@ mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length) struct stat stat_buf; if (!fstat(file,&stat_buf)) { - if (!(map=(uchar*) my_mmap(0,(size=(ulong) stat_buf.st_size),PROT_READ, + if (!(map=(uchar*) my_mmap(0,(size_t)(size= stat_buf.st_size),PROT_READ, MAP_SHARED | MAP_NORESERVE,file, 0L))) { @@ -48,7 +48,7 @@ mapped_files::mapped_files(const char * filename,uchar *magic,uint magic_length) if (map && memcmp(map,magic,magic_length)) { my_error(ER_WRONG_MAGIC, MYF(0), name); - VOID(my_munmap((char*) map,size)); + VOID(my_munmap((char*) map,(size_t)size)); map=0; } if (!map) @@ -66,7 +66,7 @@ mapped_files::~mapped_files() #ifdef HAVE_MMAP if (file >= 0) { - VOID(my_munmap((char*) map,size)); + VOID(my_munmap((char*) map,(size_t)size)); VOID(my_close(file,MYF(0))); file= -1; map=0; } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 5cfb46a99ab..8a8a03cb4e4 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2743,7 +2743,8 @@ uint32 get_list_array_idx_for_endpoint(partition_info *part_info, uint min_list_index= 0, max_list_index= part_info->no_list_values - 1; longlong list_value; /* Get the partitioning function value for the endpoint */ - longlong part_func_value= part_val_int(part_info->part_expr); + longlong part_func_value= + part_info->part_expr->val_int_endpoint(left_endpoint, &include_endpoint); bool unsigned_flag= part_info->part_expr->unsigned_flag; DBUG_ENTER("get_list_array_idx_for_endpoint"); @@ -2887,7 +2888,9 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info, uint max_partition= part_info->no_parts - 1; uint min_part_id= 0, max_part_id= max_partition, loc_part_id; /* Get the partitioning function value for the endpoint */ - longlong part_func_value= part_val_int(part_info->part_expr); + longlong part_func_value= + part_info->part_expr->val_int_endpoint(left_endpoint, &include_endpoint); + bool unsigned_flag= part_info->part_expr->unsigned_flag; DBUG_ENTER("get_partition_id_range_for_endpoint"); @@ -6590,8 +6593,6 @@ void make_used_partitions_str(partition_info *part_info, String *parts_str) #ifdef WITH_PARTITION_STORAGE_ENGINE static void set_up_range_analysis_info(partition_info *part_info) { - enum_monotonicity_info minfo; - /* Set the catch-all default */ part_info->get_part_iter_for_interval= NULL; part_info->get_subpart_iter_for_interval= NULL; @@ -6603,11 +6604,8 @@ static void set_up_range_analysis_info(partition_info *part_info) switch (part_info->part_type) { case RANGE_PARTITION: case LIST_PARTITION: - minfo= part_info->part_expr->get_monotonicity_info(); - if (minfo != NON_MONOTONIC) + if (part_info->part_expr->get_monotonicity_info() != NON_MONOTONIC) { - part_info->range_analysis_include_bounds= - test(minfo == MONOTONIC_INCREASING); part_info->get_part_iter_for_interval= get_part_iter_for_interval_via_mapping; goto setup_subparts; @@ -6775,8 +6773,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, index-in-ordered-array-of-list-constants (for LIST) space. */ store_key_image_to_rec(field, min_value, field_len); - bool include_endp= part_info->range_analysis_include_bounds || - !test(flags & NEAR_MIN); + bool include_endp= !test(flags & NEAR_MIN); part_iter->part_nums.start= get_endpoint(part_info, 1, include_endp); part_iter->part_nums.cur= part_iter->part_nums.start; if (part_iter->part_nums.start == max_endpoint_val) @@ -6790,8 +6787,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, else { store_key_image_to_rec(field, max_value, field_len); - bool include_endp= part_info->range_analysis_include_bounds || - !test(flags & NEAR_MAX); + bool include_endp= !test(flags & NEAR_MAX); part_iter->part_nums.end= get_endpoint(part_info, 0, include_endp); if (part_iter->part_nums.start == part_iter->part_nums.end && !part_iter->ret_null_part) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b903e7ae13c..b77bb719e1e 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -6126,7 +6126,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) /* Fix for EXPLAIN */ if (sel->quick) - join->best_positions[i].records_read= sel->quick->records; + join->best_positions[i].records_read= (double)sel->quick->records; } else { @@ -12353,6 +12353,12 @@ static int test_if_order_by_key(ORDER *order, TABLE *table, uint idx, for (; const_key_parts & 1 ; const_key_parts>>= 1) key_part++; + /* + The primary and secondary key parts were all const (i.e. there's + one row). The sorting doesn't matter. + */ + if (key_part == key_part_end && reverse == 0) + DBUG_RETURN(1); } else DBUG_RETURN(0); @@ -12995,7 +13001,7 @@ check_reverse_order: select->quick=tmp; } } - else if (tab->ref.key >= 0 && tab->ref.key_parts < used_key_parts) + else if (tab->ref.key >= 0 && tab->ref.key_parts <= used_key_parts) { /* SELECT * FROM t1 WHERE a=1 ORDER BY a DESC,b DESC diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 73adad222fb..f7813b73089 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -975,6 +975,60 @@ static void append_directory(THD *thd, String *packet, const char *dir_type, #define LIST_PROCESS_HOST_LEN 64 +static bool get_field_default_value(THD *thd, TABLE *table, + Field *field, String *def_value, + bool quoted) +{ + bool has_default; + bool has_now_default; + + /* + We are using CURRENT_TIMESTAMP instead of NOW because it is + more standard + */ + has_now_default= table->timestamp_field == field && + field->unireg_check != Field::TIMESTAMP_UN_FIELD; + + has_default= (field->type() != FIELD_TYPE_BLOB && + !(field->flags & NO_DEFAULT_VALUE_FLAG) && + field->unireg_check != Field::NEXT_NUMBER && + !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) + && has_now_default)); + + def_value->length(0); + if (has_default) + { + if (has_now_default) + def_value->append(STRING_WITH_LEN("CURRENT_TIMESTAMP")); + else if (!field->is_null()) + { // Not null by default + char tmp[MAX_FIELD_WIDTH]; + String type(tmp, sizeof(tmp), field->charset()); + field->val_str(&type); + if (type.length()) + { + String def_val; + uint dummy_errors; + /* convert to system_charset_info == utf8 */ + def_val.copy(type.ptr(), type.length(), field->charset(), + system_charset_info, &dummy_errors); + if (quoted) + append_unescaped(def_value, def_val.ptr(), def_val.length()); + else + def_value->append(def_val.ptr(), def_val.length()); + } + else if (quoted) + def_value->append(STRING_WITH_LEN("''")); + } + else if (field->maybe_null() && quoted) + def_value->append(STRING_WITH_LEN("NULL")); // Null as default + else + return 0; + + } + return has_default; +} + /* Build a CREATE TABLE statement for a table. @@ -989,11 +1043,11 @@ static void append_directory(THD *thd, String *packet, const char *dir_type, to tailor the format of the statement. Can be NULL, in which case only SQL_MODE is considered when building the statement. - + NOTE Currently always return 0, but might return error code in the future. - + RETURN 0 OK */ @@ -1002,9 +1056,10 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, HA_CREATE_INFO *create_info_arg) { List field_list; - char tmp[MAX_FIELD_WIDTH], *for_str, buff[128]; + char tmp[MAX_FIELD_WIDTH], *for_str, buff[128], def_value_buf[MAX_FIELD_WIDTH]; const char *alias; String type(tmp, sizeof(tmp), system_charset_info); + String def_value(def_value_buf, sizeof(def_value_buf), system_charset_info); Field **ptr,*field; uint primary_key; KEY *key_info; @@ -1057,8 +1112,6 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, for (ptr=table->field ; (field= *ptr); ptr++) { - bool has_default; - bool has_now_default; uint flags = field->flags; if (ptr != table->field) @@ -1106,44 +1159,10 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN(" NULL")); } - /* - Again we are using CURRENT_TIMESTAMP instead of NOW because it is - more standard - */ - has_now_default= table->timestamp_field == field && - field->unireg_check != Field::TIMESTAMP_UN_FIELD; - - has_default= (field->type() != MYSQL_TYPE_BLOB && - !(field->flags & NO_DEFAULT_VALUE_FLAG) && - field->unireg_check != Field::NEXT_NUMBER && - !((thd->variables.sql_mode & (MODE_MYSQL323 | MODE_MYSQL40)) - && has_now_default)); - - if (has_default) + if (get_field_default_value(thd, table, field, &def_value, 1)) { packet->append(STRING_WITH_LEN(" DEFAULT ")); - if (has_now_default) - packet->append(STRING_WITH_LEN("CURRENT_TIMESTAMP")); - else if (!field->is_null()) - { // Not null by default - type.set(tmp, sizeof(tmp), field->charset()); - field->val_str(&type); - if (type.length()) - { - String def_val; - uint dummy_errors; - /* convert to system_charset_info == utf8 */ - def_val.copy(type.ptr(), type.length(), field->charset(), - system_charset_info, &dummy_errors); - append_unescaped(packet, def_val.ptr(), def_val.length()); - } - else - packet->append(STRING_WITH_LEN("''")); - } - else if (field->maybe_null()) - packet->append(STRING_WITH_LEN("NULL")); // Null as default - else - packet->append(tmp); + packet->append(def_value.ptr(), def_value.length(), system_charset_info); } if (!limited_mysql_mode && table->timestamp_field == field && @@ -3599,7 +3618,6 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, bool is_blob; uint flags=field->flags; char tmp[MAX_FIELD_WIDTH]; - char tmp1[MAX_FIELD_WIDTH]; String type(tmp,sizeof(tmp), system_charset_info); char *end; int decimals, field_length; @@ -3645,31 +3663,10 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables, table->field[7]->store(type.ptr(), (tmp_buff ? tmp_buff - type.ptr() : type.length()), cs); - if (show_table->timestamp_field == field && - field->unireg_check != Field::TIMESTAMP_UN_FIELD) + + if (get_field_default_value(thd, show_table, field, &type, 0)) { - table->field[5]->store(STRING_WITH_LEN("CURRENT_TIMESTAMP"), cs); - table->field[5]->set_notnull(); - } - else if (field->unireg_check != Field::NEXT_NUMBER && - !field->is_null() && - !(field->flags & NO_DEFAULT_VALUE_FLAG)) - { - String def(tmp1,sizeof(tmp1), cs); - type.set(tmp, sizeof(tmp), field->charset()); - field->val_str(&type); - uint dummy_errors; - def.copy(type.ptr(), type.length(), type.charset(), cs, &dummy_errors); - table->field[5]->store(def.ptr(), def.length(), def.charset()); - table->field[5]->set_notnull(); - } - else if (field->unireg_check == Field::NEXT_NUMBER || - lex->sql_command != SQLCOM_SHOW_FIELDS || - field->maybe_null()) - table->field[5]->set_null(); // Null as default - else - { - table->field[5]->store("",0, cs); + table->field[5]->store(type.ptr(), type.length(), cs); table->field[5]->set_notnull(); } pos=(uchar*) ((flags & NOT_NULL_FLAG) ? "NO" : "YES"); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index d4df805d006..4071bb86c90 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -461,7 +461,7 @@ int mysql_update(THD *thd, init_read_record_idx(&info, thd, table, 1, used_index); thd->proc_info="Searching rows for update"; - uint tmp_limit= limit; + ha_rows tmp_limit= limit; while (!(error=info.read_record(&info)) && !thd->killed) { diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index edcd1127dbd..3fc17e18e76 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2795,15 +2795,15 @@ int ha_federated::info(uint flag) stats.records= (ha_rows) my_strtoll10(row[4], (char**) 0, &error); if (row[5] != NULL) - stats.mean_rec_length= (ha_rows) my_strtoll10(row[5], (char**) 0, &error); + stats.mean_rec_length= (ulong) my_strtoll10(row[5], (char**) 0, &error); stats.data_file_length= stats.records * stats.mean_rec_length; if (row[12] != NULL) - stats.update_time= (ha_rows) my_strtoll10(row[12], (char**) 0, + stats.update_time= (time_t) my_strtoll10(row[12], (char**) 0, &error); if (row[13] != NULL) - stats.check_time= (ha_rows) my_strtoll10(row[13], (char**) 0, + stats.check_time= (time_t) my_strtoll10(row[13], (char**) 0, &error); } /* diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 4934792de80..601d4612dda 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -197,7 +197,7 @@ void ha_heap::update_key_stats() else { ha_rows hash_buckets= file->s->keydef[i].hash_buckets; - uint no_records= hash_buckets ? file->s->records/hash_buckets : 2; + uint no_records= hash_buckets ? (uint) (file->s->records/hash_buckets) : 2; if (no_records < 2) no_records= 2; key->rec_per_key[key->key_parts-1]= no_records; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 267ebc5bb1e..bf5e6ddb1c6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5765,7 +5765,7 @@ ha_innobase::info( table->key_info[i].rec_per_key[j]= rec_per_key >= ~(ulong) 0 ? ~(ulong) 0 : - rec_per_key; + (ulong) rec_per_key; } index = dict_table_get_next_index_noninline(index); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index bc6e5706c21..ca4c40547ee 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1461,7 +1461,7 @@ void ha_myisam::start_bulk_insert(ha_rows rows) DBUG_ENTER("ha_myisam::start_bulk_insert"); THD *thd= current_thd; ulong size= min(thd->variables.read_buff_size, - table->s->avg_row_length*rows); + (ulong) (table->s->avg_row_length*rows)); DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu", (ulong) rows, size)); diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 719008d3513..70ba7a4588a 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -987,7 +987,7 @@ int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows) DBUG_RETURN(0); if (rows && rows*total_keylength < cache_size) - cache_size=rows; + cache_size= (ulong)rows; else cache_size/=total_keylength*16; diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 27e4bd37af7..2146a8d16cb 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -141,7 +141,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, if ((records < UINT_MAX32) && ((my_off_t) (records + 1) * (sort_length + sizeof(char*)) <= (my_off_t) memavl)) - keys= records+1; + keys= (uint)records+1; else do { @@ -349,7 +349,7 @@ pthread_handler_t thr_find_all_keys(void *arg) sort_keys= (uchar **) NULL; memavl= max(sort_param->sortbuff_size, MIN_SORT_MEMORY); - idx= sort_param->sort_info->max_records; + idx= (uint)sort_param->sort_info->max_records; sort_length= sort_param->key_length; maxbuffer= 1;