Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Mergen Imeev <imeevma@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: remove implicit cast for COMPARISON
Date: Sun, 26 Apr 2020 20:22:27 +0200	[thread overview]
Message-ID: <f6835f46-a2bc-cb43-20b5-44d09e51482e@tarantool.org> (raw)
In-Reply-To: <20200421124250.GA21105@tarantool.org>

Hi! Seems like you didn't push the latest version.

> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index 724bc18..34bd38d 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -3471,6 +3459,26 @@ skip_truncate:
>  	assert(oc!=OP_SeekLT || r.default_rc==+1);
>  
>  	r.aMem = &aMem[pOp->p3];
> +	for (int i = 0; i < r.nField; ++i) {
> +		enum field_type type = r.key_def->parts[i].type;
> +		struct Mem *mem = &r.aMem[i];
> +		if ((mem->flags & MEM_Str) != 0 && sql_type_is_numeric(type)) {
> +			diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
> +				field_type_strs[type], mem_type_to_str(mem));
> +			goto abort_due_to_error;
> +		}
> +		if (mem_apply_type(mem, type) != 0) {
> +			diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
> +				field_type_strs[type], mem_type_to_str(mem));
> +			goto abort_due_to_error;
> +		}
> +		if ((mem->flags & MEM_Real) != 0 &&
> +		    (type == FIELD_TYPE_INTEGER ||
> +		     type == FIELD_TYPE_UNSIGNED)) {
> +			res = 1;
> +			goto seek_not_found;
> +		}
> +	}

What is happening in this cycle and the cycle below?

>  #ifdef SQL_DEBUG
>  	{ int i; for(i=0; i<r.nField; i++) assert(memIsValid(&r.aMem[i])); }
>  #endif
> diff --git a/test/sql-tap/in1.test.lua b/test/sql-tap/in1.test.lua
> index 570cc17..e2f4988 100755
> --- a/test/sql-tap/in1.test.lua
> +++ b/test/sql-tap/in1.test.lua
> @@ -637,12 +637,12 @@ test:do_test(
>      "in-11.2",
>      function()
>          -- The '2' should be coerced into 2 because t6.b is NUMERIC

The comment is irrelevant now. And therefore the test probably too. Please,
locate all other tests, which become wrong after this commit, and fix their
comments or remove completely.

  reply	other threads:[~2020-04-26 18:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 12:34 imeevma
2020-03-29 22:29 ` Vladislav Shpilevoy
2020-03-30 11:38   ` Nikita Pettik
2020-03-30 16:53     ` Mergen Imeev
2020-04-02 23:47       ` Vladislav Shpilevoy
2020-04-21 12:42   ` Mergen Imeev
2020-04-26 18:22     ` Vladislav Shpilevoy [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-02-20  8:00 imeevma

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=f6835f46-a2bc-cb43-20b5-44d09e51482e@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/1] sql: remove implicit cast for COMPARISON' \
    /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