index a2937a0..c2e5d6b 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -1363,12 +1363,8 @@ sql_checks_resolve_space_def_reference(ExprList *expr_list,
sql_resolve_self_reference(&parser, def, NC_IsCheck, NULL, expr_list);
int rc = 0;
- if (parser.rc != SQL_OK) {
- /* Tarantool error may be already set with diag. */
- if (parser.rc != SQL_TARANTOOL_ERROR)
- diag_set(ClientError, ER_SQL, parser.zErrMsg);
+ if (parser.is_aborted)
rc = -1;
- }
sql_parser_destroy(&parser);
return rc;
diff --git a/src/box/sql.c b/src/box/sql.c
index c2e5d6bd1..ea71dd101 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -1362,9 +1362,6 @@ sql_checks_resolve_space_def_reference(ExprList *expr_list,
parser.parse_only = true;
sql_resolve_self_reference(&parser, def, NC_IsCheck, NULL, expr_list);
- int rc = 0;
- if (parser.is_aborted)
- rc = -1;
sql_parser_destroy(&parser);
- return rc;
+ return parser.is_aborted ? -1 : 0;
}
I am not sure that this should be applied. I think it isn't rightto look at field is_aborted of parser after parser destruction.
sql_parser_destroy() doesn’t affect is_abort field. On the other
hand, mb you are right, and using object after destructor is called
may seem strange. Anyway, replace pls ‘if' with ternary operator:
3 lines of code fit into one.