Commit 8a603a16 authored by Alexander Barkov's avatar Alexander Barkov

Bug#52159 returning time type from function and empty left join causes debug assertion

Problem: Item_copy did not set "fixed", which resulted in DBUG_ASSERT in some cases.
Fix: adding  initialization of the "fixed" member

Adding tests:
  mysql-test/include/ctype_numconv.inc
  mysql-test/r/ctype_binary.result
  mysql-test/r/ctype_cp1251.result
  mysql-test/r/ctype_latin1.result
  mysql-test/r/ctype_ucs.result

Adding initialization of the "fixed" member:
  sql/item.h
parent 07a9c082
......@@ -1606,3 +1606,22 @@ drop function f1;
--echo # End of WL#2649 Number-to-string conversions
--echo #
--echo #
--echo # Bug#52159 returning time type from function and empty left join causes debug assertion
--echo #
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
CREATE TABLE t1 (b INT);
INSERT INTO t1 VALUES (0);
SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
DROP FUNCTION f1;
DROP TABLE t1;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
INSERT INTO t1 VALUES ();
--disable_warnings
SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
--enable_warnings
DROP TABLE t1;
SET sql_mode=default;
......@@ -2567,5 +2567,25 @@ drop function f1;
# End of WL#2649 Number-to-string conversions
#
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
CREATE TABLE t1 (b INT);
INSERT INTO t1 VALUES (0);
SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
INSERT INTO t1 VALUES ();
SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
maketime(`a`,`a`,`a`)
00:00:00
DROP TABLE t1;
SET sql_mode=default;
#
# End of 5.5 tests
#
......@@ -2649,5 +2649,25 @@ drop function f1;
# End of WL#2649 Number-to-string conversions
#
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
CREATE TABLE t1 (b INT);
INSERT INTO t1 VALUES (0);
SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
INSERT INTO t1 VALUES ();
SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
maketime(`a`,`a`,`a`)
00:00:00
DROP TABLE t1;
SET sql_mode=default;
#
# End of 5.5 tests
#
......@@ -2977,5 +2977,25 @@ drop function f1;
# End of WL#2649 Number-to-string conversions
#
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
CREATE TABLE t1 (b INT);
INSERT INTO t1 VALUES (0);
SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
INSERT INTO t1 VALUES ();
SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
maketime(`a`,`a`,`a`)
00:00:00
DROP TABLE t1;
SET sql_mode=default;
#
# End of 5.5 tests
#
......@@ -3808,6 +3808,26 @@ drop function f1;
#
# End of WL#2649 Number-to-string conversions
#
#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
CREATE TABLE t1 (b INT);
INSERT INTO t1 VALUES (0);
SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
f1()
00:00:01
DROP FUNCTION f1;
DROP TABLE t1;
SET NAMES latin1;
SET sql_mode='';
CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
INSERT INTO t1 VALUES ();
SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
maketime(`a`,`a`,`a`)
00:00:00
DROP TABLE t1;
SET sql_mode=default;
SET NAMES latin1;
#
# End of 5.5 tests
......
......@@ -2791,6 +2791,7 @@ class Item_copy :public Item
cached_field_type= item->field_type();
cached_result_type= item->result_type();
unsigned_flag= item->unsigned_flag;
fixed= item->fixed;
}
public:
......
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