Commit a70809c0 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str

parent ff3cf749
...@@ -4887,5 +4887,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra ...@@ -4887,5 +4887,19 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: Warnings:
Note 1003 select octet_length('a') AS `LENGTH('a')`,octet_length('a') AS `LENGTHB('a')` Note 1003 select octet_length('a') AS `LENGTH('a')`,octet_length('a') AS `LENGTHB('a')`
# #
# MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str
#
CREATE TABLE t1 (c VARCHAR(8));
INSERT INTO t1 VALUES (NULL),('bar');
SELECT LPAD( c, 0, '?' ) FROM t1;
LPAD( c, 0, '?' )
NULL
SELECT RPAD( c, 0, '?' ) FROM t1;
RPAD( c, 0, '?' )
NULL
DROP TABLE t1;
#
# End of 10.3 tests # End of 10.3 tests
# #
...@@ -1889,6 +1889,18 @@ DROP TABLE t1; ...@@ -1889,6 +1889,18 @@ DROP TABLE t1;
SELECT LENGTHB('a'), LENGTHB(_utf8 0xC39F), LENGTHB(123), LENGTH(null); SELECT LENGTHB('a'), LENGTHB(_utf8 0xC39F), LENGTHB(123), LENGTH(null);
EXPLAIN EXTENDED SELECT LENGTH('a'), LENGTHB('a'); EXPLAIN EXTENDED SELECT LENGTH('a'), LENGTHB('a');
--echo #
--echo # MDEV-13555 Assertion `!item->null_value' failed in Type_handler::Item_send_str
--echo #
CREATE TABLE t1 (c VARCHAR(8));
INSERT INTO t1 VALUES (NULL),('bar');
SELECT LPAD( c, 0, '?' ) FROM t1;
SELECT RPAD( c, 0, '?' ) FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #
...@@ -3267,10 +3267,11 @@ String *Item_func_rpad::val_str(String *str) ...@@ -3267,10 +3267,11 @@ String *Item_func_rpad::val_str(String *str)
((count < 0) && !args[1]->unsigned_flag)) ((count < 0) && !args[1]->unsigned_flag))
goto err; goto err;
null_value=0;
if (count == 0) if (count == 0)
return make_empty_result(); return make_empty_result();
null_value=0;
/* Assumes that the maximum length of a String is < INT_MAX32. */ /* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */ /* Set here so that rest of code sees out-of-bound value as such. */
if ((ulonglong) count > INT_MAX32) if ((ulonglong) count > INT_MAX32)
...@@ -3358,10 +3359,11 @@ String *Item_func_lpad::val_str(String *str) ...@@ -3358,10 +3359,11 @@ String *Item_func_lpad::val_str(String *str)
((count < 0) && !args[1]->unsigned_flag)) ((count < 0) && !args[1]->unsigned_flag))
goto err; goto err;
null_value=0;
if (count == 0) if (count == 0)
return make_empty_result(); return make_empty_result();
null_value=0;
/* Assumes that the maximum length of a String is < INT_MAX32. */ /* Assumes that the maximum length of a String is < INT_MAX32. */
/* Set here so that rest of code sees out-of-bound value as such. */ /* Set here so that rest of code sees out-of-bound value as such. */
if ((ulonglong) count > INT_MAX32) if ((ulonglong) count > INT_MAX32)
......
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