[BUGFIX]repeat return error when input length is larger than max_allow_packet
This commit is contained in:
@ -147,8 +147,8 @@ int ObExprRepeat::repeat(ObString &output,
|
|||||||
if ((length > max_result_size / count) || (length > INT_MAX / count)) {
|
if ((length > max_result_size / count) || (length > INT_MAX / count)) {
|
||||||
LOG_WARN("Result of repeat was larger than max_allow_packet_size",
|
LOG_WARN("Result of repeat was larger than max_allow_packet_size",
|
||||||
K(ret), K(length), K(count), K(max_result_size));
|
K(ret), K(length), K(count), K(max_result_size));
|
||||||
LOG_USER_WARN(OB_ERR_FUNC_RESULT_TOO_LARGE, "repeat", static_cast<int>(max_result_size));
|
ret = OB_ERR_FUNC_RESULT_TOO_LARGE;
|
||||||
is_null = true;
|
LOG_USER_ERROR(OB_ERR_FUNC_RESULT_TOO_LARGE, "repeat", static_cast<int>(max_result_size));
|
||||||
} else {
|
} else {
|
||||||
//avoid realloc
|
//avoid realloc
|
||||||
if (1 == count) {
|
if (1 == count) {
|
||||||
|
@ -80,9 +80,5 @@ select repeat(1.414, 2);
|
|||||||
+------------------+
|
+------------------+
|
||||||
|
|
||||||
select repeat("abc", 200000000);
|
select repeat("abc", 200000000);
|
||||||
+--------------------------+
|
ERROR HY000: Result of repeat() was larger than max_allowed_packet (4194304) - truncated
|
||||||
| repeat("abc", 200000000) |
|
|
||||||
+--------------------------+
|
|
||||||
| NULL |
|
|
||||||
+--------------------------+
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ select repeat("abc", NULL);
|
|||||||
select repeat(1.414, 1);
|
select repeat(1.414, 1);
|
||||||
select repeat(1.414, 2);
|
select repeat(1.414, 2);
|
||||||
|
|
||||||
|
--error 1301
|
||||||
select repeat("abc", 200000000);
|
select repeat("abc", 200000000);
|
||||||
|
|
||||||
--enable_warnings
|
--enable_warnings
|
||||||
|
Reference in New Issue
Block a user