Commit e6a6f653 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types

Fixing a typo:  bit AND (&) was erroneously used instead of logical AND (&&) 
parent 8de120e2
...@@ -159,3 +159,22 @@ SELECT CONVERT( a USING latin1 ) FROM t2; ...@@ -159,3 +159,22 @@ SELECT CONVERT( a USING latin1 ) FROM t2;
CONVERT( a USING latin1 ) CONVERT( a USING latin1 )
DROP TABLE t1, t2; DROP TABLE t1, t2;
#
# Start of 5.3 tests
#
#
# MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
Warning 1292 Incorrect datetime value: '10'
Warning 1292 Incorrect datetime value: '11'
DROP TABLE t1;
#
# End of 5.3 tests
#
...@@ -97,3 +97,21 @@ SELECT CONVERT( a USING latin1 ) FROM t1; ...@@ -97,3 +97,21 @@ SELECT CONVERT( a USING latin1 ) FROM t1;
SELECT CONVERT( a USING latin1 ) FROM t2; SELECT CONVERT( a USING latin1 ) FROM t2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # Start of 5.3 tests
--echo #
--echo #
--echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
--echo #
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.3 tests
--echo #
...@@ -1960,7 +1960,7 @@ void Item_func_interval::fix_length_and_dec() ...@@ -1960,7 +1960,7 @@ void Item_func_interval::fix_length_and_dec()
for (uint i= 1; not_null_consts && i < rows; i++) for (uint i= 1; not_null_consts && i < rows; i++)
{ {
Item *el= row->element_index(i); Item *el= row->element_index(i);
not_null_consts&= el->const_item() & !el->is_null(); not_null_consts&= el->const_item() && !el->is_null();
} }
if (not_null_consts && if (not_null_consts &&
......
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