Commit 71082fd1 authored by Gleb Shchepa's avatar Gleb Shchepa

manual merge 5.1-bugteam --> 5.5-bugteam (bug 52160)

parents c4a41198 20d70497
...@@ -1425,7 +1425,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; ...@@ -1425,7 +1425,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varbinary(10) NOT NULL DEFAULT '' `c1` varbinary(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(extract(year from 20090702))); select hex(concat(extract(year from 20090702)));
......
...@@ -1507,7 +1507,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; ...@@ -1507,7 +1507,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT '' `c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(extract(year from 20090702))); select hex(concat(extract(year from 20090702)));
......
...@@ -1835,7 +1835,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; ...@@ -1835,7 +1835,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) NOT NULL DEFAULT '' `c1` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(extract(year from 20090702))); select hex(concat(extract(year from 20090702)));
......
...@@ -2667,7 +2667,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; ...@@ -2667,7 +2667,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT '' `c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(extract(year from 20090702))); select hex(concat(extract(year from 20090702)));
......
...@@ -3511,7 +3511,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1; ...@@ -3511,7 +3511,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT '' `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
select hex(concat(extract(year from 20090702))); select hex(concat(extract(year from 20090702)));
......
...@@ -1315,6 +1315,20 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); ...@@ -1315,6 +1315,20 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
1 1
1 1
DROP TABLE t1; DROP TABLE t1;
#
# Bug #52160: crash and inconsistent results when grouping
# by a function and column
#
CREATE TABLE t1(a CHAR(10) NOT NULL);
INSERT INTO t1 VALUES (''),('');
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
COUNT(*)
2
Warnings:
Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
Warning 1292 Truncated incorrect time value: ''
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
# #
# Bug#57039: constant subtime expression returns incorrect result. # Bug#57039: constant subtime expression returns incorrect result.
......
...@@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2; ...@@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2;
LENGTH(c) LENGTH(c)
65535 65535
DROP TABLE t1, t2; DROP TABLE t1, t2;
# Bug #52160: crash and inconsistent results when grouping
# by a function and column
CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
CREATE TABLE t1(a CHAR(1));
INSERT INTO t1 VALUES ('0'), ('0');
SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
COUNT(*)
2
DROP FUNCTION f1;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
...@@ -832,6 +832,16 @@ INSERT INTO t1 VALUES (0),(9.216e-096); ...@@ -832,6 +832,16 @@ INSERT INTO t1 VALUES (0),(9.216e-096);
SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug #52160: crash and inconsistent results when grouping
--echo # by a function and column
--echo #
CREATE TABLE t1(a CHAR(10) NOT NULL);
INSERT INTO t1 VALUES (''),('');
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
--echo # --echo #
......
...@@ -617,4 +617,17 @@ SELECT LENGTH(c) FROM t2; ...@@ -617,4 +617,17 @@ SELECT LENGTH(c) FROM t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo # Bug #52160: crash and inconsistent results when grouping
--echo # by a function and column
CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
CREATE TABLE t1(a CHAR(1));
INSERT INTO t1 VALUES ('0'), ('0');
SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
DROP FUNCTION f1;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -361,6 +361,7 @@ public: ...@@ -361,6 +361,7 @@ public:
const char *func_name() const { return "time_to_sec"; } const char *func_name() const { return "time_to_sec"; }
void fix_length_and_dec() void fix_length_and_dec()
{ {
maybe_null= TRUE;
decimals=0; decimals=0;
max_length=10*MY_CHARSET_BIN_MB_MAXLEN; max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
} }
......
...@@ -15218,6 +15218,8 @@ calc_group_buffer(JOIN *join,ORDER *group) ...@@ -15218,6 +15218,8 @@ calc_group_buffer(JOIN *join,ORDER *group)
{ {
key_length+= 8; key_length+= 8;
} }
else if (type == MYSQL_TYPE_BLOB)
key_length+= MAX_BLOB_WIDTH; // Can't be used as a key
else else
{ {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment