fix max length of lob types unexpected in aggregate_max_length_for_string_result

This commit is contained in:
wanghangQ 2023-11-07 04:44:10 +00:00 committed by ob-robot
parent ab7decced9
commit ccef158aba
2 changed files with 10 additions and 6 deletions

View File

@ -359,11 +359,7 @@ int ObField::get_field_mb_length(const ObObjType type,
if (OB_FAIL(common::ObCharset::get_mbmaxlen_by_coll(charsetnr, mbmaxlen))) {
LOG_WARN("fail to get mbmaxlen", K(charsetnr), K(ret));
} else {
if (lib::is_mysql_mode() && (type == ObLongTextType || type == ObJsonType || type == ObGeometryType)) {
// issue: 52728955, 52735855, 52731784, 52734963, 52729976
// compat mysql .net driver 5.7, longblob, json, gis length is max u32
length = UINT32_MAX;
} else if (lib::is_mysql_mode() && tc == ObTextTC) {
if (lib::is_mysql_mode() && tc == ObTextTC) {
// compat mysql-jdbc 8.x for judge text type by length
length = static_cast<uint32_t>(ObAccuracy::MAX_ACCURACY[type].get_length() - 1);
} else {

View File

@ -1716,7 +1716,15 @@ void ObResultSet::replace_lob_type(const ObSQLSessionInfo &session,
}
}
LOG_TRACE("init field", K(is_use_lob_locator), K(field), K(mfield.type_));
} else {
} else { // mysql mode
// issue: 52728955, 52735855, 52731784, 52734963, 52729976
// compat mysql .net driver 5.7, longblob, json, gis length is max u32
if (mfield.type_ == obmysql::EMySQLFieldType::MYSQL_TYPE_LONG_BLOB
|| mfield.type_ == obmysql::EMySQLFieldType::MYSQL_TYPE_JSON
|| mfield.type_ == obmysql::EMySQLFieldType::MYSQL_TYPE_GEOMETRY) {
mfield.length_ = UINT32_MAX;
}
if (mfield.type_ == obmysql::EMySQLFieldType::MYSQL_TYPE_TINY_BLOB ||
mfield.type_ == obmysql::EMySQLFieldType::MYSQL_TYPE_MEDIUM_BLOB ||
mfield.type_ == obmysql::EMySQLFieldType::MYSQL_TYPE_LONG_BLOB) {