Commit 3a867382 authored by unknown's avatar unknown
Browse files

Bug#10963: LEFT/RIGHT/SUBSTR/.. string functions returns wrong result \

  on large length
  
Problem:  Most (all) of the numeric inputs were being coerced into
int (32 bit) sized variables.  Works OK for sane inputs; any input
larger than 2^32 (or 2^31 for signed vars) exihibited predictable
wrapping behavior (up to about 10^18) and then started having really
strange behaviour past that point (since the conversion to 64 bit int
from the DECIMAL type can do weird things on out of range numbers).

Solution: 1)  Add many tests.  2)  Convert input from (u)long type to
(u)longlong.  3)  Do (sometimes multiple) sanity checks on input,
keeping in mind that sometimes a negative longlong is not a negative
longlong (if the unsigned_flag is set).  4) Emulate existing behavior
w/rt negative and "small" out-of-bounds values.


mysql-test/r/func_str.result:
  Additional test results for #10963
mysql-test/t/func_str.test:
  Additional test results for #10963
sql/item_func.cc:
  Used larger type for counting, to avoid truncation.
sql/item_strfunc.cc:
  Fix for #10963, including comments and cleaned up logic
parent e3f0e67b
Loading
Loading
Loading
Loading
+755 −0
Original line number Diff line number Diff line
@@ -1148,4 +1148,759 @@ id select_type table type possible_keys key key_len ref rows Extra
Warnings:
Note	1003	select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
DROP TABLE t1,t2;
select locate('he','hello',-2);
locate('he','hello',-2)
0
select locate('lo','hello',-4294967295);
locate('lo','hello',-4294967295)
0
select locate('lo','hello',4294967295);
locate('lo','hello',4294967295)
0
select locate('lo','hello',-4294967296);
locate('lo','hello',-4294967296)
0
select locate('lo','hello',4294967296);
locate('lo','hello',4294967296)
0
select locate('lo','hello',-4294967297);
locate('lo','hello',-4294967297)
0
select locate('lo','hello',4294967297);
locate('lo','hello',4294967297)
0
select locate('lo','hello',-18446744073709551615);
locate('lo','hello',-18446744073709551615)
0
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select locate('lo','hello',18446744073709551615);
locate('lo','hello',18446744073709551615)
0
select locate('lo','hello',-18446744073709551616);
locate('lo','hello',-18446744073709551616)
0
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select locate('lo','hello',18446744073709551616);
locate('lo','hello',18446744073709551616)
0
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select locate('lo','hello',-18446744073709551617);
locate('lo','hello',-18446744073709551617)
0
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select locate('lo','hello',18446744073709551617);
locate('lo','hello',18446744073709551617)
0
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select left('hello', 10);
left('hello', 10)
hello
select left('hello', 0);
left('hello', 0)

select left('hello', -1);
left('hello', -1)

select left('hello', -4294967295);
left('hello', -4294967295)

select left('hello', 4294967295);
left('hello', 4294967295)
hello
select left('hello', -4294967296);
left('hello', -4294967296)

select left('hello', 4294967296);
left('hello', 4294967296)
hello
select left('hello', -4294967297);
left('hello', -4294967297)

select left('hello', 4294967297);
left('hello', 4294967297)
hello
select left('hello', -18446744073709551615);
left('hello', -18446744073709551615)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select left('hello', 18446744073709551615);
left('hello', 18446744073709551615)
hello
select left('hello', -18446744073709551616);
left('hello', -18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select left('hello', 18446744073709551616);
left('hello', 18446744073709551616)
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select left('hello', -18446744073709551617);
left('hello', -18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select left('hello', 18446744073709551617);
left('hello', 18446744073709551617)
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select right('hello', 10);
right('hello', 10)
hello
select right('hello', 0);
right('hello', 0)

select right('hello', -1);
right('hello', -1)

select right('hello', -4294967295);
right('hello', -4294967295)

select right('hello', 4294967295);
right('hello', 4294967295)
hello
select right('hello', -4294967296);
right('hello', -4294967296)

select right('hello', 4294967296);
right('hello', 4294967296)
hello
select right('hello', -4294967297);
right('hello', -4294967297)

select right('hello', 4294967297);
right('hello', 4294967297)
hello
select right('hello', -18446744073709551615);
right('hello', -18446744073709551615)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select right('hello', 18446744073709551615);
right('hello', 18446744073709551615)
hello
select right('hello', -18446744073709551616);
right('hello', -18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select right('hello', 18446744073709551616);
right('hello', 18446744073709551616)
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select right('hello', -18446744073709551617);
right('hello', -18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select right('hello', 18446744073709551617);
right('hello', 18446744073709551617)
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 2, -1);
substring('hello', 2, -1)

select substring('hello', -1, 1);
substring('hello', -1, 1)
o
select substring('hello', -2, 1);
substring('hello', -2, 1)
l
select substring('hello', -4294967295, 1);
substring('hello', -4294967295, 1)

select substring('hello', 4294967295, 1);
substring('hello', 4294967295, 1)

select substring('hello', -4294967296, 1);
substring('hello', -4294967296, 1)

select substring('hello', 4294967296, 1);
substring('hello', 4294967296, 1)

select substring('hello', -4294967297, 1);
substring('hello', -4294967297, 1)

select substring('hello', 4294967297, 1);
substring('hello', 4294967297, 1)

select substring('hello', -18446744073709551615, 1);
substring('hello', -18446744073709551615, 1)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551615, 1);
substring('hello', 18446744073709551615, 1)

select substring('hello', -18446744073709551616, 1);
substring('hello', -18446744073709551616, 1)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551616, 1);
substring('hello', 18446744073709551616, 1)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', -18446744073709551617, 1);
substring('hello', -18446744073709551617, 1)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551617, 1);
substring('hello', 18446744073709551617, 1)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 1, -1);
substring('hello', 1, -1)

select substring('hello', 1, -4294967295);
substring('hello', 1, -4294967295)

select substring('hello', 1, 4294967295);
substring('hello', 1, 4294967295)
hello
select substring('hello', 1, -4294967296);
substring('hello', 1, -4294967296)

select substring('hello', 1, 4294967296);
substring('hello', 1, 4294967296)
hello
select substring('hello', 1, -4294967297);
substring('hello', 1, -4294967297)

select substring('hello', 1, 4294967297);
substring('hello', 1, 4294967297)
hello
select substring('hello', 1, -18446744073709551615);
substring('hello', 1, -18446744073709551615)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 1, 18446744073709551615);
substring('hello', 1, 18446744073709551615)
hello
select substring('hello', 1, -18446744073709551616);
substring('hello', 1, -18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 1, 18446744073709551616);
substring('hello', 1, 18446744073709551616)
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 1, -18446744073709551617);
substring('hello', 1, -18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 1, 18446744073709551617);
substring('hello', 1, 18446744073709551617)
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', -1, -1);
substring('hello', -1, -1)

select substring('hello', -4294967295, -4294967295);
substring('hello', -4294967295, -4294967295)

select substring('hello', 4294967295, 4294967295);
substring('hello', 4294967295, 4294967295)

select substring('hello', -4294967296, -4294967296);
substring('hello', -4294967296, -4294967296)

select substring('hello', 4294967296, 4294967296);
substring('hello', 4294967296, 4294967296)

select substring('hello', -4294967297, -4294967297);
substring('hello', -4294967297, -4294967297)

select substring('hello', 4294967297, 4294967297);
substring('hello', 4294967297, 4294967297)

select substring('hello', -18446744073709551615, -18446744073709551615);
substring('hello', -18446744073709551615, -18446744073709551615)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551615, 18446744073709551615);
substring('hello', 18446744073709551615, 18446744073709551615)

select substring('hello', -18446744073709551616, -18446744073709551616);
substring('hello', -18446744073709551616, -18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551616, 18446744073709551616);
substring('hello', 18446744073709551616, 18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', -18446744073709551617, -18446744073709551617);
substring('hello', -18446744073709551617, -18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select substring('hello', 18446744073709551617, 18446744073709551617);
substring('hello', 18446744073709551617, 18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', -1, 1, 'hi');
insert('hello', -1, 1, 'hi')
hello
select insert('hello', -4294967295, 1, 'hi');
insert('hello', -4294967295, 1, 'hi')
hello
select insert('hello', 4294967295, 1, 'hi');
insert('hello', 4294967295, 1, 'hi')
hello
select insert('hello', -4294967296, 1, 'hi');
insert('hello', -4294967296, 1, 'hi')
hello
select insert('hello', 4294967296, 1, 'hi');
insert('hello', 4294967296, 1, 'hi')
hello
select insert('hello', -4294967297, 1, 'hi');
insert('hello', -4294967297, 1, 'hi')
hello
select insert('hello', 4294967297, 1, 'hi');
insert('hello', 4294967297, 1, 'hi')
hello
select insert('hello', -18446744073709551615, 1, 'hi');
insert('hello', -18446744073709551615, 1, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551615, 1, 'hi');
insert('hello', 18446744073709551615, 1, 'hi')
hello
select insert('hello', -18446744073709551616, 1, 'hi');
insert('hello', -18446744073709551616, 1, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551616, 1, 'hi');
insert('hello', 18446744073709551616, 1, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', -18446744073709551617, 1, 'hi');
insert('hello', -18446744073709551617, 1, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551617, 1, 'hi');
insert('hello', 18446744073709551617, 1, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 1, -1, 'hi');
insert('hello', 1, -1, 'hi')
hi
select insert('hello', 1, -4294967295, 'hi');
insert('hello', 1, -4294967295, 'hi')
hi
select insert('hello', 1, 4294967295, 'hi');
insert('hello', 1, 4294967295, 'hi')
hi
select insert('hello', 1, -4294967296, 'hi');
insert('hello', 1, -4294967296, 'hi')
hi
select insert('hello', 1, 4294967296, 'hi');
insert('hello', 1, 4294967296, 'hi')
hi
select insert('hello', 1, -4294967297, 'hi');
insert('hello', 1, -4294967297, 'hi')
hi
select insert('hello', 1, 4294967297, 'hi');
insert('hello', 1, 4294967297, 'hi')
hi
select insert('hello', 1, -18446744073709551615, 'hi');
insert('hello', 1, -18446744073709551615, 'hi')
hi
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 1, 18446744073709551615, 'hi');
insert('hello', 1, 18446744073709551615, 'hi')
hi
select insert('hello', 1, -18446744073709551616, 'hi');
insert('hello', 1, -18446744073709551616, 'hi')
hi
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 1, 18446744073709551616, 'hi');
insert('hello', 1, 18446744073709551616, 'hi')
hi
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 1, -18446744073709551617, 'hi');
insert('hello', 1, -18446744073709551617, 'hi')
hi
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 1, 18446744073709551617, 'hi');
insert('hello', 1, 18446744073709551617, 'hi')
hi
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', -1, -1, 'hi');
insert('hello', -1, -1, 'hi')
hello
select insert('hello', -4294967295, -4294967295, 'hi');
insert('hello', -4294967295, -4294967295, 'hi')
hello
select insert('hello', 4294967295, 4294967295, 'hi');
insert('hello', 4294967295, 4294967295, 'hi')
hello
select insert('hello', -4294967296, -4294967296, 'hi');
insert('hello', -4294967296, -4294967296, 'hi')
hello
select insert('hello', 4294967296, 4294967296, 'hi');
insert('hello', 4294967296, 4294967296, 'hi')
hello
select insert('hello', -4294967297, -4294967297, 'hi');
insert('hello', -4294967297, -4294967297, 'hi')
hello
select insert('hello', 4294967297, 4294967297, 'hi');
insert('hello', 4294967297, 4294967297, 'hi')
hello
select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
insert('hello', -18446744073709551615, -18446744073709551615, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
insert('hello', 18446744073709551615, 18446744073709551615, 'hi')
hello
select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
insert('hello', -18446744073709551616, -18446744073709551616, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
insert('hello', 18446744073709551616, 18446744073709551616, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
insert('hello', -18446744073709551617, -18446744073709551617, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
insert('hello', 18446744073709551617, 18446744073709551617, 'hi')
hello
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select repeat('hello', -1);
repeat('hello', -1)

select repeat('hello', -4294967295);
repeat('hello', -4294967295)

select repeat('hello', 4294967295);
repeat('hello', 4294967295)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -4294967296);
repeat('hello', -4294967296)

select repeat('hello', 4294967296);
repeat('hello', 4294967296)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -4294967297);
repeat('hello', -4294967297)

select repeat('hello', 4294967297);
repeat('hello', 4294967297)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551615);
repeat('hello', -18446744073709551615)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select repeat('hello', 18446744073709551615);
repeat('hello', 18446744073709551615)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551616);
repeat('hello', -18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select repeat('hello', 18446744073709551616);
repeat('hello', 18446744073709551616)
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select repeat('hello', -18446744073709551617);
repeat('hello', -18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select repeat('hello', 18446744073709551617);
repeat('hello', 18446744073709551617)
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-1);
space(-1)

select space(-4294967295);
space(-4294967295)

select space(4294967295);
space(4294967295)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-4294967296);
space(-4294967296)

select space(4294967296);
space(4294967296)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-4294967297);
space(-4294967297)

select space(4294967297);
space(4294967297)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551615);
space(-18446744073709551615)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select space(18446744073709551615);
space(18446744073709551615)
NULL
Warnings:
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551616);
space(-18446744073709551616)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select space(18446744073709551616);
space(18446744073709551616)
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select space(-18446744073709551617);
space(-18446744073709551617)

Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select space(18446744073709551617);
space(18446744073709551617)
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -1, '1');
rpad('hello', -1, '1')
NULL
select rpad('hello', -4294967295, '1');
rpad('hello', -4294967295, '1')
NULL
select rpad('hello', 4294967295, '1');
rpad('hello', 4294967295, '1')
NULL
Warnings:
Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -4294967296, '1');
rpad('hello', -4294967296, '1')
NULL
select rpad('hello', 4294967296, '1');
rpad('hello', 4294967296, '1')
NULL
Warnings:
Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -4294967297, '1');
rpad('hello', -4294967297, '1')
NULL
select rpad('hello', 4294967297, '1');
rpad('hello', 4294967297, '1')
NULL
Warnings:
Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551615, '1');
rpad('hello', -18446744073709551615, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select rpad('hello', 18446744073709551615, '1');
rpad('hello', 18446744073709551615, '1')
NULL
Warnings:
Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551616, '1');
rpad('hello', -18446744073709551616, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select rpad('hello', 18446744073709551616, '1');
rpad('hello', 18446744073709551616, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select rpad('hello', -18446744073709551617, '1');
rpad('hello', -18446744073709551617, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select rpad('hello', 18446744073709551617, '1');
rpad('hello', 18446744073709551617, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -1, '1');
lpad('hello', -1, '1')
NULL
select lpad('hello', -4294967295, '1');
lpad('hello', -4294967295, '1')
NULL
select lpad('hello', 4294967295, '1');
lpad('hello', 4294967295, '1')
NULL
Warnings:
Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -4294967296, '1');
lpad('hello', -4294967296, '1')
NULL
select lpad('hello', 4294967296, '1');
lpad('hello', 4294967296, '1')
NULL
Warnings:
Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -4294967297, '1');
lpad('hello', -4294967297, '1')
NULL
select lpad('hello', 4294967297, '1');
lpad('hello', 4294967297, '1')
NULL
Warnings:
Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -18446744073709551615, '1');
lpad('hello', -18446744073709551615, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select lpad('hello', 18446744073709551615, '1');
lpad('hello', 18446744073709551615, '1')
NULL
Warnings:
Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -18446744073709551616, '1');
lpad('hello', -18446744073709551616, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select lpad('hello', 18446744073709551616, '1');
lpad('hello', 18446744073709551616, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
select lpad('hello', -18446744073709551617, '1');
lpad('hello', -18446744073709551617, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
select lpad('hello', 18446744073709551617, '1');
lpad('hello', 18446744073709551617, '1')
NULL
Warnings:
Error	1292	Truncated incorrect DECIMAL value: ''
Error	1292	Truncated incorrect DECIMAL value: ''
Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
End of 5.0 tests
+189 −0

File changed.

Preview size limit exceeded, changes collapsed.

+13 −7

File changed.

Preview size limit exceeded, changes collapsed.

+139 −48

File changed.

Preview size limit exceeded, changes collapsed.