diff --git a/src/sql/optimizer/ob_table_location.cpp b/src/sql/optimizer/ob_table_location.cpp index c3c2c1467d..22d2bce221 100644 --- a/src/sql/optimizer/ob_table_location.cpp +++ b/src/sql/optimizer/ob_table_location.cpp @@ -1314,10 +1314,11 @@ int ObTableLocation::get_is_weak_read(const ObDMLStmt &dml_stmt, { int ret = OB_SUCCESS; is_weak_read = false; - if (OB_ISNULL(session) || OB_ISNULL(sql_ctx)) { + if (OB_ISNULL(session) || OB_ISNULL(sql_ctx) || OB_ISNULL(dml_stmt.get_query_ctx())) { ret = OB_ERR_UNEXPECTED; LOG_ERROR("unexpected null", K(ret), K(session), K(sql_ctx)); - } else if (dml_stmt.get_query_ctx()->has_dml_write_stmt_) { + } else if (dml_stmt.get_query_ctx()->has_dml_write_stmt_ || + dml_stmt.get_query_ctx()->is_contain_select_for_update_) { is_weak_read = false; } else { ObConsistencyLevel consistency_level = INVALID_CONSISTENCY;