Skip to content

Commit 5c3dbde

Browse files
committed
manual merge 5.1-bugteam --> 5.5-bugteam (bug 52160)
--BZR-- revision-id: [email protected] property-branch-nick: mysql-5.5-bugteam testament3-sha1: 0a014d9f879789525cfb62c57883f277dfd88fb2
2 parents f3b3227 + 87ff245 commit 5c3dbde

File tree

11 files changed

+55
-5
lines changed

11 files changed

+55
-5
lines changed

mysql-test/r/ctype_binary.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1425,7 +1425,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
14251425
show create table t1;
14261426
Table Create Table
14271427
t1 CREATE TABLE `t1` (
1428-
`c1` varbinary(10) NOT NULL DEFAULT ''
1428+
`c1` varbinary(10) DEFAULT NULL
14291429
) ENGINE=MyISAM DEFAULT CHARSET=latin1
14301430
drop table t1;
14311431
select hex(concat(extract(year from 20090702)));

mysql-test/r/ctype_cp1251.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
15071507
show create table t1;
15081508
Table Create Table
15091509
t1 CREATE TABLE `t1` (
1510-
`c1` varchar(10) CHARACTER SET cp1251 NOT NULL DEFAULT ''
1510+
`c1` varchar(10) CHARACTER SET cp1251 DEFAULT NULL
15111511
) ENGINE=MyISAM DEFAULT CHARSET=latin1
15121512
drop table t1;
15131513
select hex(concat(extract(year from 20090702)));

mysql-test/r/ctype_latin1.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
18351835
show create table t1;
18361836
Table Create Table
18371837
t1 CREATE TABLE `t1` (
1838-
`c1` varchar(10) NOT NULL DEFAULT ''
1838+
`c1` varchar(10) DEFAULT NULL
18391839
) ENGINE=MyISAM DEFAULT CHARSET=latin1
18401840
drop table t1;
18411841
select hex(concat(extract(year from 20090702)));

mysql-test/r/ctype_ucs.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
26672667
show create table t1;
26682668
Table Create Table
26692669
t1 CREATE TABLE `t1` (
2670-
`c1` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
2670+
`c1` varchar(10) CHARACTER SET ucs2 DEFAULT NULL
26712671
) ENGINE=MyISAM DEFAULT CHARSET=latin1
26722672
drop table t1;
26732673
select hex(concat(extract(year from 20090702)));

mysql-test/r/ctype_utf8.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,7 @@ create table t1 as select concat(time_to_sec('10:11:12')) as c1;
35113511
show create table t1;
35123512
Table Create Table
35133513
t1 CREATE TABLE `t1` (
3514-
`c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
3514+
`c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
35153515
) ENGINE=MyISAM DEFAULT CHARSET=latin1
35163516
drop table t1;
35173517
select hex(concat(extract(year from 20090702)));

mysql-test/r/func_time.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,20 @@ SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
13151315
1
13161316
1
13171317
DROP TABLE t1;
1318+
#
1319+
# Bug #52160: crash and inconsistent results when grouping
1320+
# by a function and column
1321+
#
1322+
CREATE TABLE t1(a CHAR(10) NOT NULL);
1323+
INSERT INTO t1 VALUES (''),('');
1324+
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
1325+
COUNT(*)
1326+
2
1327+
Warnings:
1328+
Warning 1292 Truncated incorrect time value: ''
1329+
Warning 1292 Truncated incorrect time value: ''
1330+
Warning 1292 Truncated incorrect time value: ''
1331+
DROP TABLE t1;
13181332
End of 5.1 tests
13191333
#
13201334
# Bug#57039: constant subtime expression returns incorrect result.

mysql-test/r/type_blob.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,4 +975,14 @@ SELECT LENGTH(c) FROM t2;
975975
LENGTH(c)
976976
65535
977977
DROP TABLE t1, t2;
978+
# Bug #52160: crash and inconsistent results when grouping
979+
# by a function and column
980+
CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
981+
CREATE TABLE t1(a CHAR(1));
982+
INSERT INTO t1 VALUES ('0'), ('0');
983+
SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
984+
COUNT(*)
985+
2
986+
DROP FUNCTION f1;
987+
DROP TABLE t1;
978988
End of 5.1 tests

mysql-test/t/func_time.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,16 @@ INSERT INTO t1 VALUES (0),(9.216e-096);
832832
SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
833833
DROP TABLE t1;
834834

835+
--echo #
836+
--echo # Bug #52160: crash and inconsistent results when grouping
837+
--echo # by a function and column
838+
--echo #
839+
840+
CREATE TABLE t1(a CHAR(10) NOT NULL);
841+
INSERT INTO t1 VALUES (''),('');
842+
SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a);
843+
DROP TABLE t1;
844+
835845
--echo End of 5.1 tests
836846

837847
--echo #

mysql-test/t/type_blob.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,4 +617,17 @@ SELECT LENGTH(c) FROM t2;
617617

618618
DROP TABLE t1, t2;
619619

620+
--echo # Bug #52160: crash and inconsistent results when grouping
621+
--echo # by a function and column
622+
623+
CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1;
624+
625+
CREATE TABLE t1(a CHAR(1));
626+
INSERT INTO t1 VALUES ('0'), ('0');
627+
628+
SELECT COUNT(*) FROM t1 GROUP BY f1(), a;
629+
630+
DROP FUNCTION f1;
631+
DROP TABLE t1;
632+
620633
--echo End of 5.1 tests

sql/item_timefunc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ class Item_func_time_to_sec :public Item_int_func
361361
const char *func_name() const { return "time_to_sec"; }
362362
void fix_length_and_dec()
363363
{
364+
maybe_null= TRUE;
364365
decimals=0;
365366
max_length=10*MY_CHARSET_BIN_MB_MAXLEN;
366367
}

0 commit comments

Comments
 (0)