[CP][BUGFIX] fix lrpad mysql pad len zero

This commit is contained in:
obdev
2024-02-09 07:07:47 +00:00
committed by ob-robot
parent 68638d77f1
commit b75fc423ec
3 changed files with 58 additions and 4 deletions

View File

@ -552,11 +552,11 @@ int ObExprBaseLRpad::calc_mysql_inner(const LRpadType pad_type,
// only substr needed
result_size = ObCharset::charpos(cs_type, str_text.ptr(), str_text.length(), int_len);
res.set_string(ObString(result_size, str_text.ptr()));
} else if (str_pad.length() == 0) {
res.set_null(); // mysql 5.7 return null while mysql 8.0 return empty string
} else {
has_set_to_lob_locator = true;
if (str_pad.length() == 0) {
res.set_string(ObString::make_empty_string());
} else if (OB_FAIL(get_padding_info_mysql(cs_type, str_text, int_len, str_pad,
if (OB_FAIL(get_padding_info_mysql(cs_type, str_text, int_len, str_pad,
max_result_size, repeat_count, prefix_size, result_size))) {
LOG_WARN("Failed to get padding info", K(ret), K(str_text), K(int_len),
K(str_pad), K(max_result_size));