From f4eb080a846ef6219f3f11b4d9fe54f59935163c Mon Sep 17 00:00:00 2001 From: obdev Date: Fri, 25 Aug 2023 10:40:29 +0000 Subject: [PATCH] fix mysqltest --- src/sql/resolver/ddl/ob_create_table_resolver.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sql/resolver/ddl/ob_create_table_resolver.cpp b/src/sql/resolver/ddl/ob_create_table_resolver.cpp index f3d5f312ce..0ade95be0a 100644 --- a/src/sql/resolver/ddl/ob_create_table_resolver.cpp +++ b/src/sql/resolver/ddl/ob_create_table_resolver.cpp @@ -1846,11 +1846,13 @@ int ObCreateTableResolver::resolve_table_elements_from_select(const ParseNode &p (ObRawExpr::EXPR_CONST == expr->get_expr_class() || (ObRawExpr::EXPR_OPERATOR == expr->get_expr_class() && expr->is_static_const_expr())) && - !expr->get_result_type().is_null() && - !expr->get_result_type().is_datetime()) { - common::ObObj zero_obj(0); - if (OB_FAIL(column.set_cur_default_value(zero_obj))) { - LOG_WARN("set default value failed", K(ret)); + !expr->get_result_type().is_null()) { + common::ObObjType result_type = expr->get_result_type().get_obj_meta().get_type(); + if (ob_is_numeric_type(result_type) || ob_is_string_tc(result_type) || ob_is_time_tc(result_type)) { + common::ObObj zero_obj(0); + if (OB_FAIL(column.set_cur_default_value(zero_obj))) { + LOG_WARN("set default value failed", K(ret)); + } } } else { /*do nothing*/ } }