bugfix : mysql json_table

This commit is contained in:
obdev
2023-11-21 09:19:22 +00:00
committed by ob-robot
parent 8a64369f76
commit 7312d74d62
3 changed files with 21 additions and 5 deletions

View File

@ -1216,8 +1216,13 @@ int ObDMLStmtPrinter::print_json_table_nested_column(const TableItem *table_item
DATA_PRINTF(" null on empty");
} else if (col_info.on_empty_ == 2) {
DATA_PRINTF(" default ");
if (OB_SUCC(ret)
&& OB_FAIL(expr_printer_.do_print(cur_def->empty_expr_, T_NONE_SCOPE))) {
if (OB_FAIL(ret)) {
} else if (T_BOOL == cur_def->empty_expr_->get_expr_type()) { // bool need print 'true' or 'false' int json_table, not 1=1'
ObConstRawExpr *con_expr = static_cast<ObConstRawExpr*>(cur_def->empty_expr_);
if (OB_FAIL(databuff_printf(buf_, buf_len_, *pos_, con_expr->get_value().get_bool() ? "true" : "false"))) {
LOG_WARN("fail to print startup filter", K(ret));
}
} else if (OB_FAIL(expr_printer_.do_print(cur_def->empty_expr_, T_NONE_SCOPE))) {
LOG_WARN("fail to print default value col", K(ret));
}
DATA_PRINTF(" on empty");
@ -1230,8 +1235,13 @@ int ObDMLStmtPrinter::print_json_table_nested_column(const TableItem *table_item
DATA_PRINTF(" null on error");
} else if (col_info.on_error_ == 2) {
DATA_PRINTF(" default ");
if (OB_SUCC(ret)
&& OB_FAIL(expr_printer_.do_print(cur_def->error_expr_, T_NONE_SCOPE))) {
if (OB_FAIL(ret)) {
} else if (T_BOOL == cur_def->error_expr_->get_expr_type()) { // bool need print 'true' or 'false' int json_table, not 1=1'
ObConstRawExpr *con_expr = static_cast<ObConstRawExpr*>(cur_def->error_expr_);
if (OB_FAIL(databuff_printf(buf_, buf_len_, *pos_, con_expr->get_value().get_bool() ? "true" : "false"))) {
LOG_WARN("fail to print startup filter", K(ret));
}
} else if (OB_FAIL(expr_printer_.do_print(cur_def->error_expr_, T_NONE_SCOPE))) {
LOG_WARN("fail to print default value col", K(ret));
}
DATA_PRINTF(" on error");