Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
	Kirill Shcherbatov <kshcherbatov@tarantool.org>,
	korablev@tarantool.org
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: invalid integer type in arithmetic operations
Date: Wed, 24 Apr 2019 22:56:18 +0300	[thread overview]
Message-ID: <0929e575-2d28-7cd0-36bc-0a1bf1af76fe@tarantool.org> (raw)
In-Reply-To: <72941eba60647c98f4559cbd0c862bade990d761.1556120090.git.kshcherbatov@tarantool.org>

> 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;
>  }
>  

  parent reply	other threads:[~2019-04-24 19:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 15:36 [tarantool-patches] " Kirill Shcherbatov
2019-04-24 19:43 ` [tarantool-patches] " n.pettik
2019-04-25  7:32   ` Kirill Shcherbatov
2019-04-24 19:56 ` Vladislav Shpilevoy [this message]
2019-04-24 23:03   ` n.pettik
2019-04-25 10:49     ` Konstantin Osipov
2019-04-25 10:52       ` Konstantin Osipov
2019-04-25 11:07         ` Kirill Shcherbatov
2019-04-25 11:15           ` Konstantin Osipov
2019-04-25 11:21             ` Kirill Shcherbatov
2019-04-25 10:37 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0929e575-2d28-7cd0-36bc-0a1bf1af76fe@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: invalid integer type in arithmetic operations' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox