List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:November 26 2010 4:16pm
Subject:bzr push into mysql-trunk-bugfixing branch (Georgi.Kodinov:3398 to 3399)
View as plain text  
 3399 Georgi Kodinov	2010-11-26 [merge]
      merge

 3398 Georgi Kodinov	2010-11-26 [merge]
      merge

    removed:
      mysql-test/suite/optimizer_unfixed_bugs/
      mysql-test/suite/optimizer_unfixed_bugs/README.txt
      mysql-test/suite/optimizer_unfixed_bugs/r/
      mysql-test/suite/optimizer_unfixed_bugs/r/bug42991.result
      mysql-test/suite/optimizer_unfixed_bugs/r/bug49129.result
      mysql-test/suite/optimizer_unfixed_bugs/t/
      mysql-test/suite/optimizer_unfixed_bugs/t/bug42991.test
      mysql-test/suite/optimizer_unfixed_bugs/t/bug49129.test
    added:
      mysql-test/include/ctype_8bit.inc
      mysql-test/include/ctype_czech.inc
      mysql-test/include/ctype_like_ignorable.inc
      mysql-test/r/ctype_like_range.result
      mysql-test/t/ctype_like_range.test
    modified:
      client/mysql.cc
      client/mysqlbinlog.cc
      client/mysqlcheck.c
      client/mysqltest.cc
      extra/comp_err.c
      extra/resolve_stack_dump.c
      include/m_ctype.h
      include/my_sys.h
      mysql-test/extra/rpl_tests/rpl_change_master_bind.inc
      mysql-test/include/icp_tests.inc
      mysql-test/r/create.result
      mysql-test/r/ctype_binary.result
      mysql-test/r/ctype_collate.result
      mysql-test/r/ctype_cp1251.result
      mysql-test/r/ctype_latin1.result
      mysql-test/r/ctype_uca.result
      mysql-test/r/ctype_utf16_uca.result
      mysql-test/r/ctype_utf32_uca.result
      mysql-test/r/ctype_utf8.result
      mysql-test/r/ctype_utf8mb4_uca.result
      mysql-test/r/explain.result
      mysql-test/r/index_merge_innodb.result
      mysql-test/r/index_merge_myisam.result
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/innodb_mrr_none.result
      mysql-test/r/join_cache_jcl1.result
      mysql-test/r/join_nested.result
      mysql-test/r/join_optimizer.result
      mysql-test/r/merge.result
      mysql-test/r/mix2_myisam.result
      mysql-test/r/myisam.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/mysql.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/null.result
      mysql-test/r/optimizer_switch.result
      mysql-test/r/ps_1general.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none_jcl6.result
      mysql-test/suite/innodb/r/innodb.result
      mysql-test/suite/innodb/r/innodb_lock_wait_timeout_1.result
      mysql-test/suite/innodb/r/innodb_mysql.result
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/r/rpl_change_master_crash_safe.result
      mysql-test/suite/sys_vars/r/optimizer_switch_basic.result
      mysql-test/t/ctype_cp1251.test
      mysql-test/t/ctype_uca.test
      mysql-test/t/ctype_utf16_uca.test
      mysql-test/t/ctype_utf32_uca.test
      mysql-test/t/ctype_utf8mb4_uca.test
      mysql-test/t/mysql.test
      mysys/array.c
      mysys/default.c
      mysys/mf_tempdir.c
      sql-common/client.c
      sql/item_create.cc
      sql/item_func.cc
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/mysqld.cc
      sql/opt_range.cc
      sql/rpl_filter.cc
      sql/rpl_handler.cc
      sql/rpl_mi.cc
      sql/rpl_slave.cc
      sql/set_var.h
      sql/share/charsets/cp1251.xml
      sql/sp_head.cc
      sql/sp_pcontext.cc
      sql/sp_pcontext.h
      sql/sql_array.h
      sql/sql_audit.cc
      sql/sql_plugin.cc
      sql/sql_priv.h
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_show.cc
      sql/sql_test.cc
      sql/sys_vars.cc
      sql/uniques.cc
      storage/federated/ha_federated.cc
      strings/ctype-extra.c
      strings/ctype-mb.c
      strings/ctype-uca.c
      strings/ctype-ucs2.c
=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result	2010-11-26 13:46:21 +0000
+++ b/mysql-test/r/ctype_utf8.result	2010-11-26 15:45:26 +0000
@@ -1989,6 +1989,37 @@ CONVERT(a, CHAR)	CONVERT(b, CHAR)
 70000	1092
 DROP TABLE t1;
 End of 5.0 tests
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя'));
+LENGTH(RPAD(0.0115E88, 61297, _utf8'яэюя'))
+122587
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя'));
+LENGTH(RPAD(0.0115E88, 61297, _utf8'йцуя'))
+122587
+SELECT HEX(RPAD(0x20, 2, _utf8 0xD18F));
+HEX(RPAD(0x20, 2, _utf8 0xD18F))
+20D1
+SELECT HEX(RPAD(0x20, 4, _utf8 0xD18F));
+HEX(RPAD(0x20, 4, _utf8 0xD18F))
+20D18FD1
+SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
+HEX(LPAD(0x20, 2, _utf8 0xD18F))
+D120
+SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
+HEX(LPAD(0x20, 4, _utf8 0xD18F))
+D18FD120
+SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
+HEX(RPAD(_utf8 0xD18F, 3, 0x20))
+D18F20
+SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
+HEX(LPAD(_utf8 0xD18F, 3, 0x20))
+20D18F
+SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
+HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20))
+D120
+SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
+HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20))
+D120D18E
+End of 5.1 tests
 Start of 5.4 tests
 SET NAMES utf8mb3;
 SHOW VARIABLES LIKE 'character_set_results%';

=== modified file 'mysql-test/r/explain.result'
--- a/mysql-test/r/explain.result	2010-11-17 15:23:17 +0000
+++ b/mysql-test/r/explain.result	2010-11-26 15:45:26 +0000
@@ -272,6 +272,52 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 A
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ref	c2,c2_2	c2	10	const,const	3	Using where
 DROP TABLE t1;
+#
+# Bug#56814 Explain + subselect + fulltext crashes server
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
+FULLTEXT KEY(f1),UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	system	NULL	NULL	NULL	NULL	1	
+2	SUBQUERY	a	system	NULL	NULL	NULL	NULL	1	Using filesort
+2	SUBQUERY	t1	fulltext	f1	f1	0		1	Using where
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	system	NULL	NULL	NULL	NULL	1	
+2	SUBQUERY	a	system	NULL	NULL	NULL	NULL	1	Using filesort
+2	SUBQUERY	t1	fulltext	f1	f1	0		1	Using where
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	system	NULL	NULL	NULL	NULL	1	
+2	SUBQUERY	a	system	NULL	NULL	NULL	NULL	1	Using filesort
+2	SUBQUERY	t1	fulltext	f1	f1	0		1	Using where
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	system	NULL	NULL	NULL	NULL	1	
+2	SUBQUERY	a	system	NULL	NULL	NULL	NULL	1	Using filesort
+2	SUBQUERY	t1	fulltext	f1	f1	0		1	Using where
+EXECUTE stmt;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	system	NULL	NULL	NULL	NULL	1	
+2	SUBQUERY	a	system	NULL	NULL	NULL	NULL	1	Using filesort
+2	SUBQUERY	t1	fulltext	f1	f1	0		1	Using where
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
 End of 5.1 tests.
 #
 # Bug#46860: 

=== modified file 'mysql-test/r/fulltext.result'
--- a/mysql-test/r/fulltext.result	2010-04-02 15:17:43 +0000
+++ b/mysql-test/r/fulltext.result	2010-11-26 14:32:51 +0000
@@ -652,4 +652,49 @@ Table	Op	Msg_type	Msg_text
 test.t1	repair	status	OK
 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
 DROP TABLE t1;
+#
+# Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+#
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+SELECT 1 FROM t1 WHERE 1 >
+ALL((SELECT 1 FROM t1 JOIN t1 a
+ON (MATCH(t1.f1) against (""))
+WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+1
+1
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'test'
+Warning	1292	Truncated incorrect INTEGER value: 'test'
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+EXECUTE stmt;
+1
+1
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'test'
+Warning	1292	Truncated incorrect INTEGER value: 'test'
+EXECUTE stmt;
+1
+1
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'test'
+Warning	1292	Truncated incorrect INTEGER value: 'test'
+DEALLOCATE PREPARE stmt;
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+EXECUTE stmt;
+1
+1
+EXECUTE stmt;
+1
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/r/func_gconcat.result'
--- a/mysql-test/r/func_gconcat.result	2010-10-05 09:15:51 +0000
+++ b/mysql-test/r/func_gconcat.result	2010-11-26 15:20:05 +0000
@@ -1038,6 +1038,14 @@ GROUP_CONCAT(t1.a ORDER BY t1.a)
 1,1,2,2
 DEALLOCATE PREPARE stmt;
 DROP TABLE t1;
+#
+# Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
+#
+CREATE TABLE t1(f1 int);
+INSERT INTO t1 values (0),(0);
+SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
+ERROR 22007: Illegal non geometric '(select 1 from (select (1 = group_concat(`test`.`t1`.`f1` separator ',')) AS `1 IN (GROUP_CONCAT(t1.f1))` from `test`.`t1` join `test`.`t1` `t` group by `t`.`f1`) `d`)' value found during parsing
+DROP TABLE t1;
 End of 5.1 tests
 DROP TABLE IF EXISTS t1, t2;
 CREATE TABLE t1 (a VARCHAR(6), b INT);

=== modified file 'mysql-test/r/func_math.result'
--- a/mysql-test/r/func_math.result	2010-11-17 15:39:35 +0000
+++ b/mysql-test/r/func_math.result	2010-11-26 14:32:51 +0000
@@ -481,6 +481,18 @@ RAND(i)
 0.15522042769493574
 DROP TABLE t1;
 #
+# Bug#57477 SIGFPE when dividing a huge number a negative number
+#
+SELECT -9999999999999999991 DIV -1;
+ERROR 22003: BIGINT value is out of range in '(-(9999999999999999991) DIV -(1))'
+SELECT -9223372036854775808 DIV -1;
+ERROR 22003: BIGINT value is out of range in '(-(9223372036854775808) DIV -(1))'
+SELECT -9223372036854775808 MOD -1;
+-9223372036854775808 MOD -1
+0
+SELECT -9223372036854775808999 MOD -1;
+-9223372036854775808999 MOD -1
+0
 select 123456789012345678901234567890.123456789012345678901234567890 div 1 as x;
 ERROR 22003: BIGINT value is out of range in '(123456789012345678901234567890.123456789012345678901234567890 DIV 1)'
 select "123456789012345678901234567890.123456789012345678901234567890" div 1 as x;

=== modified file 'mysql-test/r/func_misc.result'
--- a/mysql-test/r/func_misc.result	2010-11-18 13:02:24 +0000
+++ b/mysql-test/r/func_misc.result	2010-11-26 14:32:51 +0000
@@ -351,6 +351,12 @@ GREATEST(a, (SELECT b FROM t1 LIMIT 1))
 3
 1
 DROP TABLE t1;
+SELECT INET_NTOA(0);
+INET_NTOA(0)
+0.0.0.0
+SELECT '1' IN ('1', INET_NTOA(0));
+'1' IN ('1', INET_NTOA(0))
+1
 #
 # Bug #52165: Assertion failed: file .\dtoa.c, line 465
 # 
@@ -382,3 +388,4 @@ CREATE TABLE t1 (a INT);
 SELECT 1 from t1 HAVING NAME_CONST('', a);
 ERROR HY000: Incorrect arguments to NAME_CONST
 DROP TABLE t1;
+End of tests

=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result	2010-11-17 15:23:17 +0000
+++ b/mysql-test/r/group_by.result	2010-11-26 15:45:26 +0000
@@ -1846,6 +1846,16 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM
 SUBSTRING(a,1,10)	LENGTH(a)
 1111111111	1300
 DROP TABLE t1;
+#
+# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+#
+CREATE TABLE t1(f1 INT NOT NULL);
+INSERT INTO t1 VALUES (16777214),(0);
+SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
+ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
+COUNT(*)
+2
+DROP TABLE t1;
 # End of 5.1 tests
 #
 # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00

=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	2010-09-01 14:00:12 +0000
+++ b/mysql-test/r/join_outer.result	2010-11-26 15:20:05 +0000
@@ -1402,6 +1402,36 @@ id	select_type	table	type	possible_keys	
 Warnings:
 Note	1003	select straight_join `test`.`jt1`.`f1` AS `f1` from `test`.`t1` `jt6` left join (`test`.`t1` `jt3` join `test`.`t1` `jt4` left join `test`.`t1` `jt5` on(1) left join `test`.`t1` `jt2` on(1)) on((`test`.`jt6`.`f1` and 1)) left join `test`.`t1` `jt1` on(1) where 1
 DROP TABLE t1;
+#
+# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+#
+CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
+INSERT INTO t1 VALUES (4);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (7, 7);
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	PRIMARY	NULL	NULL	NULL	1	Using temporary; Using filesort
+1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	const	1	Using index
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+f1	f1	f2
+4	NULL	NULL
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	system	PRIMARY	NULL	NULL	NULL	1	Using filesort
+1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	const	1	Using where; Using index
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+f1	f1	f2
+DROP TABLE t1,t2;
 End of 5.1 tests
 #
 # Bug#54235 Extra rows with join_cache_level=4,6,8 and two LEFT JOIN

=== modified file 'mysql-test/r/myisam_mrr_none.result'
--- a/mysql-test/r/myisam_mrr_none.result	2010-07-16 11:51:02 +0000
+++ b/mysql-test/r/myisam_mrr_none.result	2010-11-26 15:20:05 +0000
@@ -346,7 +346,7 @@ GROUP BY t2.pk
 );
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
-2	SUBQUERY	t2	ALL	int_key	int_key	5	const	3	33.33	Using filesort
+2	SUBQUERY	t2	ref	int_key	int_key	5	const	1	100.00	Using where; Using filesort
 Warnings:
 Note	1003	select min(`test`.`t1`.`pk`) AS `MIN(t1.pk)` from `test`.`t1` where 0
 DROP TABLE t1, t2;

=== modified file 'mysql-test/r/partition_innodb.result'
--- a/mysql-test/r/partition_innodb.result	2010-11-19 07:26:09 +0000
+++ b/mysql-test/r/partition_innodb.result	2010-11-26 14:32:51 +0000
@@ -1,5 +1,31 @@
 drop table if exists t1, t2;
 #
+# Bug#56287: crash when using Partition datetime in sub in query
+#
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+c2 varchar(40) not null default '',
+c3 datetime not  NULL,
+PRIMARY KEY (c1,c3),
+KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+PARTITION p201912 VALUES LESS THAN MAXVALUE);
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+PARTITION_NAME	TABLE_ROWS
+p200912	0
+p201103	1
+p201912	0
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+count(*)
+0
+DROP TABLE t1;
+#
 # Bug#54747: Deadlock between REORGANIZE PARTITION and
 #            SELECT is not detected
 #

=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test	2010-11-09 08:19:01 +0000
+++ b/mysql-test/t/ctype_utf8.test	2010-11-26 15:20:05 +0000
@@ -1459,6 +1459,25 @@ DROP TABLE t1;
 --echo End of 5.0 tests
 
 
+#
+# Bug #57272: crash in rpad() when using utf8
+#
+SELECT LENGTH(RPAD(0.0115E88, 61297, _utf8'яCT HEX(RPAD(0x20, 4, _utf8 0xD18F));
+SELECT HEX(LPAD(0x20, 2, _utf8 0xD18F));
+SELECT HEX(LPAD(0x20, 4, _utf8 0xD18F));
+
+SELECT HEX(RPAD(_utf8 0xD18F, 3, 0x20));
+SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20));
+
+SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20));
+SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20));
+
+
+--echo End of 5.1 tests
+
 --echo Start of 5.4 tests
 
 #

=== modified file 'mysql-test/t/explain.test'
--- a/mysql-test/t/explain.test	2010-09-09 10:58:40 +0000
+++ b/mysql-test/t/explain.test	2010-11-26 15:20:05 +0000
@@ -247,6 +247,42 @@ EXPLAIN SELECT c1 FROM t1 WHERE c2 = 1 A
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#56814 Explain + subselect + fulltext crashes server
+--echo #
+
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL,
+FULLTEXT KEY(f1),UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+
+EXPLAIN SELECT 1 FROM t1
+WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a ON (MATCH(t1.f1) AGAINST (""))
+WHERE t1.f1 GROUP BY t1.f1));
+
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+PREPARE stmt FROM
+'EXPLAIN SELECT 1 FROM t1
+ WHERE 1 > ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) AGAINST (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests.
 
 --echo #

=== modified file 'mysql-test/t/fulltext.test'
--- a/mysql-test/t/fulltext.test	2010-04-02 15:17:43 +0000
+++ b/mysql-test/t/fulltext.test	2010-11-26 14:32:51 +0000
@@ -594,4 +594,40 @@ REPAIR TABLE t1;
 SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#54484 explain + prepared statement: crash and Got error -1 from storage engine
+--echo #
+
+CREATE TABLE t1(f1 VARCHAR(6) NOT NULL, FULLTEXT KEY(f1), UNIQUE(f1));
+INSERT INTO t1 VALUES ('test');
+
+SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1;
+
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 RIGHT OUTER JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1)) xor f1';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+PREPARE stmt FROM
+'SELECT 1 FROM t1 WHERE 1 >
+ ALL((SELECT 1 FROM t1 JOIN t1 a
+ ON (MATCH(t1.f1) against (""))
+ WHERE t1.f1 GROUP BY t1.f1))';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1;
+
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/func_gconcat.test'
--- a/mysql-test/t/func_gconcat.test	2010-08-20 13:10:49 +0000
+++ b/mysql-test/t/func_gconcat.test	2010-11-26 14:32:51 +0000
@@ -738,6 +738,17 @@ EXECUTE stmt;
 DEALLOCATE PREPARE stmt;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#57194 group_concat cause crash and/or invalid memory reads with type errors
+--echo #
+
+CREATE TABLE t1(f1 int);
+INSERT INTO t1 values (0),(0);
+--disable_ps_protocol
+--error ER_ILLEGAL_VALUE_FOR_TYPE
+SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t GROUP BY t.f1 ) d));
+--enable_ps_protocol
+DROP TABLE t1;
 
 --echo End of 5.1 tests
 

=== modified file 'mysql-test/t/func_math.test'
--- a/mysql-test/t/func_math.test	2010-11-17 15:39:35 +0000
+++ b/mysql-test/t/func_math.test	2010-11-26 14:32:51 +0000
@@ -316,6 +316,14 @@ SELECT RAND(i) FROM t1;
 DROP TABLE t1;
 
 --echo #
+--echo # Bug#57477 SIGFPE when dividing a huge number a negative number
+--echo #
+--error ER_DATA_OUT_OF_RANGE
+SELECT -9999999999999999991 DIV -1;
+--error ER_DATA_OUT_OF_RANGE
+SELECT -9223372036854775808 DIV -1;
+SELECT -9223372036854775808 MOD -1;
+SELECT -9223372036854775808999 MOD -1;
 
 #
 # Bug #8457: Precision math:

=== modified file 'mysql-test/t/func_misc.test'
--- a/mysql-test/t/func_misc.test	2010-11-18 13:02:24 +0000
+++ b/mysql-test/t/func_misc.test	2010-11-26 14:32:51 +0000
@@ -480,6 +480,13 @@ SELECT DISTINCT GREATEST(a, (SELECT b FR
 DROP TABLE t1;
 
 
+#
+# Bug #57283: inet_ntoa() crashes
+#
+SELECT INET_NTOA(0);
+SELECT '1' IN ('1', INET_NTOA(0));
+
+
 --echo #
 --echo # Bug #52165: Assertion failed: file .\dtoa.c, line 465
 --echo # 
@@ -516,3 +523,4 @@ SELECT 1 from t1 HAVING NAME_CONST('', a
 
 DROP TABLE t1;
 
+--echo End of tests

=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test	2010-10-25 09:20:53 +0000
+++ b/mysql-test/t/group_by.test	2010-11-26 15:20:05 +0000
@@ -1236,6 +1236,17 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM
 SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+--echo #
+
+CREATE TABLE t1(f1 INT NOT NULL);
+INSERT INTO t1 VALUES (16777214),(0);
+
+SELECT COUNT(*) FROM t1 LEFT JOIN t1 t2
+ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
+
+DROP TABLE t1;
 
 --echo # End of 5.1 tests
 

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	2010-08-26 13:26:03 +0000
+++ b/mysql-test/t/join_outer.test	2010-11-26 15:20:05 +0000
@@ -981,6 +981,35 @@ EXPLAIN EXTENDED SELECT STRAIGHT_JOIN jt
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
+--echo #
+
+CREATE TABLE t1 (f1 INT NOT NULL, PRIMARY KEY (f1));
+CREATE TABLE t2 (f1 INT NOT NULL, f2 INT NOT NULL, PRIMARY KEY (f1, f2));
+
+INSERT INTO t1 VALUES (4);
+INSERT INTO t2 VALUES (3, 3);
+INSERT INTO t2 VALUES (7, 7);
+
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4
+GROUP BY t2.f1, t2.f2;
+
+EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+
+SELECT * FROM t1 LEFT JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f1 = 4 AND t2.f1 IS NOT NULL AND t2.f2 IS NOT NULL
+GROUP BY t2.f1, t2.f2;
+
+DROP TABLE t1,t2;
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'mysql-test/t/partition_innodb.test'
--- a/mysql-test/t/partition_innodb.test	2010-11-19 07:26:09 +0000
+++ b/mysql-test/t/partition_innodb.test	2010-11-26 14:32:51 +0000
@@ -9,6 +9,31 @@ drop table if exists t1, t2;
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 --echo #
+--echo # Bug#56287: crash when using Partition datetime in sub in query
+--echo #
+CREATE TABLE t1
+(c1 bigint(20) unsigned NOT NULL AUTO_INCREMENT,
+ c2 varchar(40) not null default '',
+ c3 datetime not  NULL,
+ PRIMARY KEY (c1,c3),
+ KEY partidx(c3))
+ENGINE=InnoDB
+PARTITION BY RANGE (TO_DAYS(c3))
+(PARTITION p200912 VALUES LESS THAN (to_days('2010-01-01')),
+ PARTITION p201103 VALUES LESS THAN (to_days('2011-04-01')),
+ PARTITION p201912 VALUES LESS THAN MAXVALUE);
+
+insert into t1(c2,c3) values ("Test row",'2010-01-01 00:00:00');
+
+SELECT PARTITION_NAME, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
+SELECT count(*) FROM t1 p where c3 in
+(select c3 from t1 t where t.c3 < date '2011-04-26 19:19:44'
+ and t.c3 > date '2011-04-26 19:18:44') ;
+
+DROP TABLE t1;
+
+
+--echo #
 --echo # Bug#54747: Deadlock between REORGANIZE PARTITION and
 --echo #            SELECT is not detected
 --echo #
@@ -109,6 +134,7 @@ SELECT * FROM t1;
 COMMIT;
 DROP TABLE t1;
 
+
 --echo #
 --echo # Bug#51830: Incorrect partition pruning on range partition (regression)
 --echo #
@@ -552,6 +578,19 @@ connection default;
 SELECT * FROM t1;
 COMMIT;
 DROP TABLE t1;
+
+#
+# Bug #55146    Assertion `m_part_spec.start_part == m_part_spec.end_part' in index_read_idx_map
+#
+
+CREATE TABLE t1 (i1 int NOT NULL primary key, f1 int) ENGINE = InnoDB
+    PARTITION BY HASH(i1) PARTITIONS 2;
+
+INSERT INTO t1 VALUES (1,1), (2,2);
+
+SELECT * FROM t1 WHERE i1 = ( SELECT i1 FROM t1 WHERE f1=0 LIMIT 1 );
+
+DROP TABLE t1;
 --enable_parsing
 
 --echo #

=== modified file 'mysys/my_symlink.c'
--- a/mysys/my_symlink.c	2009-10-27 13:20:34 +0000
+++ b/mysys/my_symlink.c	2010-10-17 11:00:13 +0000
@@ -113,7 +113,6 @@ int my_is_symlink(const char *filename _
 #endif
 }
 
-
 /*
   Resolve all symbolic links in path
   'to' may be equal to 'filename'
@@ -147,7 +146,23 @@ int my_realpath(char *to, const char *fi
   }
   DBUG_RETURN(result);
 #else
+#ifdef _WIN32
+  int ret= GetFullPathName(filename,FN_REFLEN,
+                           to,
+                           NULL);
+  if (ret == 0 || ret > FN_REFLEN)
+  {
+    if (ret > FN_REFLEN)
+      my_errno= ENAMETOOLONG;
+    else
+      my_errno= EACCES;
+    if (MyFlags & MY_WME)
+      my_error(EE_REALPATH, MYF(0), filename, my_errno);
+	  return -1;
+  }
+#else
   my_load_path(to, filename, NullS);
+#endif
   return 0;
 #endif
 }

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2010-11-16 00:21:26 +0000
+++ b/sql/ha_partition.cc	2010-11-26 15:20:05 +0000
@@ -4426,8 +4426,12 @@ int ha_partition::index_read_idx_map(uch
 
     get_partition_set(table, buf, index, &m_start_key, &m_part_spec);
 
-    /* How can it be more than one partition with the current use? */
-    DBUG_ASSERT(m_part_spec.start_part == m_part_spec.end_part);
+    /* 
+      We have either found exactly 1 partition
+      (in which case start_part == end_part)
+      or no matching partitions (start_part > end_part)
+    */
+    DBUG_ASSERT(m_part_spec.start_part >= m_part_spec.end_part);
 
     for (part= m_part_spec.start_part; part <= m_part_spec.end_part; part++)
     {
@@ -4662,6 +4666,7 @@ int ha_partition::partition_scan_set_up(
       key not found.
     */
     DBUG_PRINT("info", ("scan with no partition to scan"));
+    table->status= STATUS_NOT_FOUND;
     DBUG_RETURN(HA_ERR_END_OF_FILE);
   }
   if (m_part_spec.start_part == m_part_spec.end_part)
@@ -4686,6 +4691,7 @@ int ha_partition::partition_scan_set_up(
     if (start_part == MY_BIT_NONE)
     {
       DBUG_PRINT("info", ("scan with no partition to scan"));
+      table->status= STATUS_NOT_FOUND;
       DBUG_RETURN(HA_ERR_END_OF_FILE);
     }
     if (start_part > m_part_spec.start_part)

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2010-11-26 13:46:21 +0000
+++ b/sql/item_func.cc	2010-11-26 15:45:26 +0000
@@ -5754,7 +5754,17 @@ void Item_func_match::init_search(bool n
 
   /* Check if init_search() has been called before */
   if (ft_handler)
+  {
+    /*
+      We should reset ft_handler as it is cleaned up
+      on destruction of FT_SELECT object
+      (necessary in case of re-execution of subquery).
+      TODO: FT_SELECT should not clean up ft_handler.
+    */
+    if (join_key)
+      table->file->ft_handler= ft_handler;
     DBUG_VOID_RETURN;
+  }
 
   if (key == NO_SUCH_KEY)
   {

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2010-10-27 10:28:09 +0000
+++ b/sql/item_func.h	2010-11-26 15:20:05 +0000
@@ -1604,7 +1604,7 @@ public:
        join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { }
   void cleanup()
   {
-    DBUG_ENTER("Item_func_match");
+    DBUG_ENTER("Item_func_match::cleanup");
     Item_real_func::cleanup();
     if (!master && ft_handler)
       ft_handler->please->close_search(ft_handler);

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2010-11-26 11:36:39 +0000
+++ b/sql/item_strfunc.cc	2010-11-26 15:48:03 +0000
@@ -1184,6 +1184,20 @@ String *Item_func_insert::val_str(String
   if ((length < 0) || (length > res->length()))
     length= res->length();
 
+  /*
+    There is one exception not handled (intentionaly) by the character set
+    aggregation code. If one string is strong side and is binary, and
+    another one is weak side and is a multi-byte character string,
+    then we need to operate on the second string in terms on bytes when
+    calling ::numchars() and ::charpos(), rather than in terms of characters.
+    Lets substitute its character set to binary.
+  */
+  if (collation.collation == &my_charset_bin)
+  {
+    res->set_charset(&my_charset_bin);
+    res2->set_charset(&my_charset_bin);
+  }
+
   /* start and length are now sufficiently valid to pass to charpos function */
    start= res->charpos((int) start);
    length= res->charpos((int) length, (uint32) start);
@@ -2725,6 +2739,20 @@ String *Item_func_rpad::val_str(String *
   /* Set here so that rest of code sees out-of-bound value as such. */
   if ((ulonglong) count > INT_MAX32)
     count= INT_MAX32;
+  /*
+    There is one exception not handled (intentionaly) by the character set
+    aggregation code. If one string is strong side and is binary, and
+    another one is weak side and is a multi-byte character string,
+    then we need to operate on the second string in terms on bytes when
+    calling ::numchars() and ::charpos(), rather than in terms of characters.
+    Lets substitute its character set to binary.
+  */
+  if (collation.collation == &my_charset_bin)
+  {
+    res->set_charset(&my_charset_bin);
+    rpad->set_charset(&my_charset_bin);
+  }
+
   if (count <= (res_char_length= res->numchars()))
   {						// String to pad is big enough
     res->length(res->charpos((int) count));	// Shorten result if longer
@@ -2814,6 +2842,20 @@ String *Item_func_lpad::val_str(String *
   if ((ulonglong) count > INT_MAX32)
     count= INT_MAX32;
 
+  /*
+    There is one exception not handled (intentionaly) by the character set
+    aggregation code. If one string is strong side and is binary, and
+    another one is weak side and is a multi-byte character string,
+    then we need to operate on the second string in terms on bytes when
+    calling ::numchars() and ::charpos(), rather than in terms of characters.
+    Lets substitute its character set to binary.
+  */
+  if (collation.collation == &my_charset_bin)
+  {
+    res->set_charset(&my_charset_bin);
+    pad->set_charset(&my_charset_bin);
+  }
+
   res_char_length= res->numchars();
 
   if (count <= res_char_length)

=== modified file 'sql/item_subselect.cc'
--- a/sql/item_subselect.cc	2010-10-27 10:28:09 +0000
+++ b/sql/item_subselect.cc	2010-11-26 15:20:05 +0000
@@ -2868,28 +2868,30 @@ subselect_single_select_engine::save_joi
      3) Call does not come from select_describe()). If it does,
         JOIN::exec() will not call make_simple_join() and the JOIN we
         plan to save will not be replaced anyway.
-     4) A temp table is needed. This is what triggers JOIN::exec() to
-        make a replacement JOIN by calling make_simple_join(). 
-     5) The Item_subselect is cacheable
+     4) The Item_subselect is cacheable
   */
   if (thd->lex->describe &&                              // 1
       !select_lex->uncacheable &&                        // 2
-      !(join->select_options & SELECT_DESCRIBE) &&       // 3
-      join->need_tmp)                                    // 4
+      !(join->select_options & SELECT_DESCRIBE))         // 3
   {
     item->update_used_tables();
-    if (item->const_item())                              // 5
+    if (item->const_item())                              // 4
     {
       /*
-        Save this JOIN to join->tmp_join since the original layout will
-        be replaced when JOIN::exec() calls make_simple_join() due to
-        need_tmp==TRUE. The original layout is needed so we can describe
-        the query. No need to do this if uncacheable != 0 since in this
-        case the JOIN has already been saved during JOIN::optimize()
+        It's necessary to keep original JOIN table because
+        create_sort_index() function may overwrite original
+        JOIN_TAB::type and wrong optimization method can be
+        selected on re-execution.
       */
       select_lex->uncacheable|= UNCACHEABLE_EXPLAIN;
       select_lex->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN;
-      if (join->init_save_join_tab())
+      /*
+        Force join->join_tmp creation, because this subquery will be replaced
+        by a simple select from the materialization temp table by optimize()
+        called by EXPLAIN and we need to preserve the initial query structure
+        so we can display it.
+      */
+      if (join->need_tmp && join->init_save_join_tab())
         return TRUE;
     }
   }

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2010-10-27 10:28:09 +0000
+++ b/sql/item_sum.cc	2010-11-26 15:20:05 +0000
@@ -3398,8 +3398,6 @@ String* Item_func_group_concat::val_str(
 
 void Item_func_group_concat::print(String *str, enum_query_type query_type)
 {
-  /* orig_args is not filled with valid values until fix_fields() */
-  Item **pargs= fixed ? orig_args : args;
   str->append(STRING_WITH_LEN("group_concat("));
   if (distinct)
     str->append(STRING_WITH_LEN("distinct "));
@@ -3407,7 +3405,7 @@ void Item_func_group_concat::print(Strin
   {
     if (i)
       str->append(',');
-    pargs[i]->print(str, query_type);
+    orig_args[i]->print(str, query_type);
   }
   if (arg_count_order)
   {
@@ -3416,7 +3414,7 @@ void Item_func_group_concat::print(Strin
     {
       if (i)
         str->append(',');
-      pargs[i + arg_count_field]->print(str, query_type);
+      orig_args[i + arg_count_field]->print(str, query_type);
       if (order[i]->asc)
         str->append(STRING_WITH_LEN(" ASC"));
       else

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2010-11-26 13:46:21 +0000
+++ b/sql/sql_select.cc	2010-11-26 15:45:26 +0000
@@ -2679,6 +2679,9 @@ JOIN::reinit()
       func->clear();
   }
 
+  if (!(select_options & SELECT_DESCRIBE))
+    init_ftfuncs(thd, select_lex, test(order));
+
   DBUG_RETURN(0);
 }
 
@@ -3451,6 +3454,13 @@ mysql_select(THD *thd, Item ***rref_poin
 	{
 	  DBUG_RETURN(TRUE);
 	}
+        /*
+          Original join tabs might be overwritten at first
+          subselect execution. So we need to restore them.
+        */
+        Item_subselect *subselect= select_lex->master_unit()->item;
+        if (subselect && subselect->is_uncacheable() && join->reinit())
+          DBUG_RETURN(TRUE);
       }
       else
       {
@@ -19573,6 +19583,8 @@ static bool
 list_contains_unique_index(TABLE *table,
                           bool (*find_func) (Field *, void *), void *data)
 {
+  if (table->pos_in_table_list->outer_join)
+    return 0;
   for (uint keynr= 0; keynr < table->s->keys; keynr++)
   {
     if (keynr == table->s->primary_key ||
@@ -19586,7 +19598,7 @@ list_contains_unique_index(TABLE *table,
            key_part < key_part_end;
            key_part++)
       {
-        if (key_part->field->maybe_null() || 
+        if (key_part->field->real_maybe_null() || 
             !find_func(key_part->field, data))
           break;
       }

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-bugfixing branch (Georgi.Kodinov:3398 to 3399) Georgi Kodinov26 Nov