[tarantool-patches] Re: [PATCH v1 1/1] sql: invalid integer type in arithmetic operations
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Wed Apr 24 22:56:18 MSK 2019
> diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
> index b3613d3ea..9b52e90f3 100644
> --- a/src/box/sql/expr.c
> +++ b/src/box/sql/expr.c
> @@ -342,8 +342,19 @@ sql_expr_coll(Parse *parse, Expr *p, bool *is_explicit_coll, uint32_t *coll_id,
> enum field_type
> sql_type_result(enum field_type lhs, enum field_type rhs)
> {
> - if (sql_type_is_numeric(lhs) || sql_type_is_numeric(rhs))
> + if (sql_type_is_numeric(lhs) || sql_type_is_numeric(rhs)) {
> + if (lhs == FIELD_TYPE_NUMBER || rhs == FIELD_TYPE_NUMBER)
> + return FIELD_TYPE_NUMBER;
> + if (lhs == FIELD_TYPE_INTEGER || rhs == FIELD_TYPE_INTEGER)
> + return FIELD_TYPE_INTEGER;
> + /*
> + * FIXME: FIELD_TYPE_UNSIGNED static type is not
> + * allowed yet.
> + */
> + assert(lhs == FIELD_TYPE_UNSIGNED ||
> + rhs == FIELD_TYPE_UNSIGNED);
How does it work? If it is not allowed, then lhs and rhs should not
be equal to FIELD_TYPE_UNSIGNED, and this assertion should fail, it is not?
(I did not test, just looked at the diff in the mailing list)
> return FIELD_TYPE_NUMBER;
> + }
> return FIELD_TYPE_SCALAR;
> }
>
More information about the Tarantool-patches
mailing list