bugfix: json_object_t on_error && json_object_t duplicate key && regression case

This commit is contained in:
wu-xingying
2023-09-20 16:50:01 +00:00
committed by ob-robot
parent 98d6d32ccc
commit 7df46cab65
5 changed files with 24 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@ -1162,7 +1162,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_DEFAULT_FOR_MODIFYING_VIEWS, -5511, -1, "42000", "Exp
DEFINE_ERROR_EXT(OB_ERR_FK_COLUMN_NOT_NULL, -5512, ER_FK_COLUMN_NOT_NULL, "HY000", "Column cannot be NOT NULL: needed in a foreign key constraint SET NULL", "Column \'%s\' cannot be NOT NULL: needed in a foreign key constraint \'%s\' SET NULL");
DEFINE_ORACLE_ERROR(OB_ERR_UNSUPPORTED_FK_SET_NULL_ON_GENERATED_COLUMN, -5513, ER_UNSUPPORTED_FK_SET_NULL_ON_GENERATED_COLUMN, "HY000", " Cannot define foreign key with ON DELETE SET NULL clause on a generated column", 54036, "cannot define referential constraint with ON DELETE SET NULL clause on virtual column");
DEFINE_ORACLE_ERROR(OB_JSON_PROCESSING_ERROR, -5514, -1, "42000", " JSON processing error", 40444, " JSON processing error");
DEFINE_ERROR(OB_ERR_TABLE_WITHOUT_ALIAS, -5515, ER_TF_MUST_HAVE_ALIAS, "42000", "Every table function must have an alias");
DEFINE_ERROR_EXT(OB_ERR_SP_ALREADY_EXISTS, -5541, ER_SP_ALREADY_EXISTS, "42000", "procedure/function already exists", "%s %.*s already exists");

View File

@ -866,6 +866,7 @@ constexpr int OB_ERR_WINDOW_RANGE_BOUND_NOT_CONSTANT = -5510;
constexpr int OB_ERR_DEFAULT_FOR_MODIFYING_VIEWS = -5511;
constexpr int OB_ERR_FK_COLUMN_NOT_NULL = -5512;
constexpr int OB_ERR_UNSUPPORTED_FK_SET_NULL_ON_GENERATED_COLUMN = -5513;
constexpr int OB_JSON_PROCESSING_ERROR = -5514;
constexpr int OB_ERR_TABLE_WITHOUT_ALIAS = -5515;
constexpr int OB_ERR_SP_ALREADY_EXISTS = -5541;
constexpr int OB_ERR_SP_DOES_NOT_EXIST = -5542;
@ -2826,6 +2827,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_DEFAULT_FOR_MODIFYING_VIEWS__USER_ERROR_MSG "Explicit column default is not supported for modifying views"
#define OB_ERR_FK_COLUMN_NOT_NULL__USER_ERROR_MSG "Column \'%s\' cannot be NOT NULL: needed in a foreign key constraint \'%s\' SET NULL"
#define OB_ERR_UNSUPPORTED_FK_SET_NULL_ON_GENERATED_COLUMN__USER_ERROR_MSG " Cannot define foreign key with ON DELETE SET NULL clause on a generated column"
#define OB_JSON_PROCESSING_ERROR__USER_ERROR_MSG " JSON processing error"
#define OB_ERR_TABLE_WITHOUT_ALIAS__USER_ERROR_MSG "Every table function must have an alias"
#define OB_ERR_SP_ALREADY_EXISTS__USER_ERROR_MSG "%s %.*s already exists"
#define OB_ERR_SP_DOES_NOT_EXIST__USER_ERROR_MSG "%s %.*s.%.*s does not exist"
@ -4955,6 +4957,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_DEFAULT_FOR_MODIFYING_VIEWS__ORA_USER_ERROR_MSG "ORA-32575: Explicit column default is not supported for modifying views"
#define OB_ERR_FK_COLUMN_NOT_NULL__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5512, Column \'%s\' cannot be NOT NULL: needed in a foreign key constraint \'%s\' SET NULL"
#define OB_ERR_UNSUPPORTED_FK_SET_NULL_ON_GENERATED_COLUMN__ORA_USER_ERROR_MSG "ORA-54036: cannot define referential constraint with ON DELETE SET NULL clause on virtual column"
#define OB_JSON_PROCESSING_ERROR__ORA_USER_ERROR_MSG "ORA-40444: JSON processing error"
#define OB_ERR_TABLE_WITHOUT_ALIAS__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5515, Every table function must have an alias"
#define OB_ERR_SP_ALREADY_EXISTS__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5541, %s %.*s already exists"
#define OB_ERR_SP_DOES_NOT_EXIST__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5542, %s %.*s.%.*s does not exist"
@ -6047,7 +6050,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_DATA_TOO_LONG_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-12899: value too large for column %.*s (actual: %ld, maximum: %ld)"
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
extern int g_all_ob_errnos[2125];
extern int g_all_ob_errnos[2126];
const char *ob_error_name(const int oberr);
const char* ob_error_cause(const int oberr);

View File

@ -319,7 +319,7 @@ int ObJsonExprHelper::eval_oracle_json_val(ObExpr *expr,
INIT_SUCC(ret);
ObDatum *json_datum = nullptr;
ObExpr *json_arg = expr;
bool is_bool_data_type = json_arg->is_boolean_;
bool is_bool_data_type = (json_arg->is_boolean_ || json_arg->datum_meta_.type_ == ObTinyIntType);
if (OB_FAIL(json_arg->eval(ctx, json_datum))) {
LOG_WARN("eval json arg failed", K(ret), K(json_arg->datum_meta_));

View File

@ -1887,13 +1887,13 @@ int ObSqlParameterization::mark_tree(ParseNode *tree ,SqlInfo &sql_info)
}
}
} else if(T_FUN_SYS_JSON_QUERY == tree->type_) {
if (10 != tree->num_child_) {
if (11 != tree->num_child_) {
ret = OB_INVALID_ARGUMENT;
SQL_PC_LOG(WARN, "invalid json query expr argument", K(ret), K(tree->num_child_));
} else {
const int64_t ARGS_NUMBER_TEN = 10;
bool mark_arr[ARGS_NUMBER_TEN] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // json doc type will affect returning type,
if (OB_FAIL(mark_args(tree, mark_arr, ARGS_NUMBER_TEN, sql_info))) {
const int64_t ARGS_NUMBER_ELEVEN = 11;
bool mark_arr[ARGS_NUMBER_ELEVEN] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; // json doc type will affect returning type,
if (OB_FAIL(mark_args(tree, mark_arr, ARGS_NUMBER_ELEVEN, sql_info))) {
SQL_PC_LOG(WARN, "fail to mark substr arg", K(ret));
}
}