Automerge of mysql-5.1-bugteam to mysql-trunk-merge.

This commit is contained in:
Alexey Kopytov 2010-04-11 11:17:42 +04:00
commit abab51e0db
22 changed files with 221 additions and 18 deletions

View File

@ -858,7 +858,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#endif
#ifndef OS_FILE_LIMIT
#define OS_FILE_LIMIT 65535
#define OS_FILE_LIMIT UINT_MAX
#endif
/* #define EXT_IN_LIBNAME */

View File

@ -1230,6 +1230,14 @@ SELECT HEX(DAYNAME(19700101));
HEX(DAYNAME(19700101))
0427043504420432043504400433
SET character_set_connection=latin1;
#
# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
#
CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
CREATE VIEW v1 AS SELECT 1 from t1
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests
#
# Start of 5.5 tests

View File

@ -130,4 +130,22 @@ SELECT @query;
@query
abcde,0,1234
DROP PROCEDURE p1;
#
# Bug #40625: Concat fails on DOUBLE values in a Stored Procedure,
# while DECIMAL works
#
CREATE PROCEDURE p1()
BEGIN
DECLARE v1 DOUBLE(10,3);
SET v1= 100;
SET @s = CONCAT('########################################', 40 , v1);
SELECT @s;
END;//
CALL p1();
@s
########################################40100.000
CALL p1();
@s
########################################40100.000
DROP PROCEDURE p1;
# End of 5.1 tests

View File

@ -472,7 +472,7 @@ HAVING (table2.f2 = 8 AND table1.f1 >= 6);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
Warnings:
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having (('7' = 8) and (`test`.`table1`.`f1` >= 6))
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0
EXPLAIN EXTENDED
SELECT table1.f1, table2.f2
FROM t1 AS table1
@ -483,6 +483,50 @@ HAVING (table2.f2 = 8);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible HAVING noticed after reading const tables
Warnings:
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having ('7' = 8)
Note 1003 select `test`.`table1`.`f1` AS `f1`,'7' AS `f2` from `test`.`t1` `table1` join `test`.`t1` `table2` where ((`test`.`table1`.`f3` = '9')) group by `test`.`table1`.`f1`,'7' having 0
DROP TABLE t1;
#
# Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
#
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES (10,8);
CREATE TABLE t2 (f1 INT);
INSERT INTO t2 VALUES (5);
SELECT COUNT(f1) FROM t2
HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1);
COUNT(f1)
DROP TABLE t1, t2;
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
INSERT INTO t1 VALUES (16,'f');
INSERT INTO t1 VALUES (16,'f');
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
INSERT INTO t2 VALUES (13,'f');
INSERT INTO t2 VALUES (20,'f');
CREATE TABLE t3 (f1 INT, f2 VARCHAR(1));
INSERT INTO t3 VALUES (7,'f');
SELECT t1.f2 FROM t1
STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2
HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1)
ORDER BY f2;
f2
f
f
f
f
DROP TABLES t1,t2,t3;
#
# Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411
#
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
INSERT INTO t1 VALUES (16,'d');
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
INSERT INTO t2 VALUES (13,'e');
INSERT INTO t2 VALUES (20,'d');
SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2
HAVING ('e' , 'd') IN
(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1)
ORDER BY t1.f2;
MAX(t2.f2)
NULL
DROP TABLE t1,t2;
End of 5.0 tests

View File

@ -3986,6 +3986,14 @@ CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE
ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
#
# Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
#
CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
CREATE VIEW v1 AS SELECT 1 from t1
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
# -----------------------------------------------------------------
# -- End of 5.1 tests.
# -----------------------------------------------------------------

View File

@ -1,3 +1,7 @@
# List of disabled tests
# test name : comment
#rpl_redirect : Fails due to bug#49978
rpl_redirect : Fails due to bug#49978
crash_manycolumns_string : Bug#50495 'Row size too large' for plugin, but works for built-in innodb
ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value

View File

@ -986,7 +986,7 @@ c1 c2 c3 c4
2155 2155 1998-12-26 1998-12-26 11:30:45
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2;
total_rows min_value max(c2)
20 1901 2155
20 0 2155
SELECT * FROM t2 WHERE c3 = '1998-12-11';
c1 c2 c3 c4
1990 1990 1998-12-11 1998-12-11 11:30:45
@ -1400,7 +1400,7 @@ c1 c2 c3 c4
2155 2155 1998-12-26 1998-12-26 11:30:45
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2;
total_rows min_value max(c2)
20 1901 2155
20 0 2155
SELECT * FROM t2 WHERE c3 = '1998-12-11';
c1 c2 c3 c4
1990 1990 1998-12-11 1998-12-11 11:30:45

View File

@ -791,9 +791,6 @@ Warning 1292 Truncated incorrect datetime value: '2009-01-10 23:60:59'
SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */;
count(*)
0
Warnings:
Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1
Warning 1292 Incorrect datetime value: '2001-01-11 23:59:60' for column 'c2' at row 1
SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00';
c1 c2 c3
0000-00-00 00:00:00 0000-00-00 00:00:00 6

View File

@ -0,0 +1 @@
insert_calendar : Bug #52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value

View File

@ -7812,10 +7812,15 @@ SELECT * FROM t2 ORDER BY c1,c6 LIMIT 2;
SELECT * FROM t2 ORDER BY c1,c6 DESC LIMIT 2;
## ref type access
# Bug#52283 : Remove the following --disable_warnings
# command when the bug is fixed
--disable_warnings
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6;
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 LIMIT 2;
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 DESC;
SELECT * FROM t2 WHERE c1 = 18446744073709551616 ORDER BY c1,c6 DESC LIMIT 2;
--enable_warnings
## Range access, ordered ##
SELECT * FROM t2 WHERE c1 <> 18446744073709551616 ORDER BY c1,c6;

View File

@ -300,7 +300,12 @@ INSERT INTO t1 VALUES('2001-01-09','2001-01-10',6),('2001-01-11','2001-01-12',7)
UPDATE t1 SET c1='2001-01-09 24:59:59',c2='2009-01-10 23:60:59' WHERE c1='2001-01-09';
UPDATE t1 SET c2='2001-01-11 23:59:60' WHERE c1='2001-01-11';
SELECT count(*) FROM t1 WHERE c1='2001-01-09 24:59:59' AND c2='2009-01-10 23:60:59';
# Bug#52283 : Remove the following --disable_warnings
# command when the bug is fixed
--disable_warnings
SELECT count(*) FROM t1 WHERE c2='2001-01-11 23:59:60' /* returns 0 */;
--enable_warnings
--sorted_result
SELECT * FROM t1 WHERE c1='0000-00-00 00:00:00' OR c2='0000-00-00 00:00:00';

View File

@ -732,6 +732,15 @@ SELECT HEX(MONTHNAME(19700101));
SELECT HEX(DAYNAME(19700101));
SET character_set_connection=latin1;
--echo #
--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
--echo #
CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
CREATE VIEW v1 AS SELECT 1 from t1
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
--echo End of 5.0 tests

View File

@ -124,4 +124,24 @@ SELECT @query;
DROP PROCEDURE p1;
--echo #
--echo # Bug #40625: Concat fails on DOUBLE values in a Stored Procedure,
--echo # while DECIMAL works
--echo #
DELIMITER //;
CREATE PROCEDURE p1()
BEGIN
DECLARE v1 DOUBLE(10,3);
SET v1= 100;
SET @s = CONCAT('########################################', 40 , v1);
SELECT @s;
END;//
DELIMITER ;//
CALL p1();
CALL p1();
DROP PROCEDURE p1;
--echo # End of 5.1 tests

View File

@ -498,4 +498,49 @@ HAVING (table2.f2 = 8);
DROP TABLE t1;
--echo #
--echo # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
--echo #
CREATE TABLE t1(f1 INT, f2 INT);
INSERT INTO t1 VALUES (10,8);
CREATE TABLE t2 (f1 INT);
INSERT INTO t2 VALUES (5);
SELECT COUNT(f1) FROM t2
HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1);
DROP TABLE t1, t2;
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
INSERT INTO t1 VALUES (16,'f');
INSERT INTO t1 VALUES (16,'f');
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
INSERT INTO t2 VALUES (13,'f');
INSERT INTO t2 VALUES (20,'f');
CREATE TABLE t3 (f1 INT, f2 VARCHAR(1));
INSERT INTO t3 VALUES (7,'f');
SELECT t1.f2 FROM t1
STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2
HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1)
ORDER BY f2;
DROP TABLES t1,t2,t3;
--echo #
--echo # Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411
--echo #
CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
INSERT INTO t1 VALUES (16,'d');
CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
INSERT INTO t2 VALUES (13,'e');
INSERT INTO t2 VALUES (20,'d');
SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2
HAVING ('e' , 'd') IN
(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1)
ORDER BY t1.f2;
DROP TABLE t1,t2;
--echo End of 5.0 tests

View File

@ -3953,6 +3953,15 @@ ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
--echo #
CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
CREATE VIEW v1 AS SELECT 1 from t1
WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
DROP VIEW v1;
DROP TABLE t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------

View File

@ -72,7 +72,7 @@ static uint set_max_open_files(uint max_file_limit)
}
#else
static int set_max_open_files(uint max_file_limit)
static uint set_max_open_files(uint max_file_limit)
{
/* We don't know the limit. Return best guess */
return min(max_file_limit, OS_FILE_LIMIT);

View File

@ -199,6 +199,7 @@ parse_arguments() {
;;
--nice=*) niceness="$val" ;;
--open-files-limit=*) open_files="$val" ;;
--open_files_limit=*) open_files="$val" ;;
--skip-kill-mysqld*) KILL_MYSQLD=0 ;;
--syslog) want_syslog=1 ;;
--skip-syslog) want_syslog=0 ;;
@ -545,10 +546,14 @@ then
if test -n "$open_files"
then
ulimit -n $open_files
append_arg_to_args "--open-files-limit=$open_files"
fi
fi
if test -n "$open_files"
then
append_arg_to_args "--open-files-limit=$open_files"
fi
safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
# Make sure that directory for $safe_mysql_unix_port exists
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`

View File

@ -1781,7 +1781,16 @@ bool agg_item_set_converter(DTCollation &coll, const char *fname,
if (!(conv= (*arg)->safe_charset_converter(coll.collation)) &&
((*arg)->collation.repertoire == MY_REPERTOIRE_ASCII))
conv= new Item_func_conv_charset(*arg, coll.collation, 1);
{
/*
We should disable const subselect item evaluation because
subselect transformation does not happen in view_prepare_mode
and thus val_...() methods can not be called for const items.
*/
bool resolve_const= ((*arg)->type() == Item::SUBSELECT_ITEM &&
thd->lex->view_prepare_mode) ? FALSE : TRUE;
conv= new Item_func_conv_charset(*arg, coll.collation, resolve_const);
}
if (!conv)
{

View File

@ -357,7 +357,7 @@ String *Item_func_concat::val_str(String *str)
}
else if (str->alloced_length() >= res->length()+res2->length())
{
if (str == res2)
if (str->ptr() == res2->ptr())
str->replace(0,0,*res);
else
{

View File

@ -122,6 +122,21 @@ void Item_subselect::cleanup()
DBUG_VOID_RETURN;
}
/*
We cannot use generic Item::safe_charset_converter() because
Subselect transformation does not happen in view_prepare_mode
and thus we can not evaluate val_...() for const items.
*/
Item *Item_subselect::safe_charset_converter(CHARSET_INFO *tocs)
{
Item_func_conv_charset *conv=
new Item_func_conv_charset(this, tocs, thd->lex->view_prepare_mode ? 0 : 1);
return conv->safe ? conv : NULL;
}
void Item_singlerow_subselect::cleanup()
{
DBUG_ENTER("Item_singlerow_subselect::cleanup");

View File

@ -129,6 +129,7 @@ public:
virtual void reset_value_registration() {}
enum_parsing_place place() { return parsing_place; }
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
Item *safe_charset_converter(CHARSET_INFO *tocs);
/**
Get the SELECT_LEX structure associated with this Item.

View File

@ -1128,13 +1128,13 @@ JOIN::optimize()
elements may be lost during further having
condition transformation in JOIN::exec.
*/
if (having && !having->with_sum_func)
if (having && const_table_map)
{
COND *const_cond= make_cond_for_table(having, const_table_map, 0);
DBUG_EXECUTE("where", print_where(const_cond, "const_having_cond",
QT_ORDINARY););
if (const_cond && !const_cond->val_int())
having->update_used_tables();
having= remove_eq_conds(thd, having, &having_value);
if (having_value == Item::COND_FALSE)
{
having= new Item_int((longlong) 0,1);
zero_result_cause= "Impossible HAVING noticed after reading const tables";
error= 0;
DBUG_RETURN(0);