Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Imeev Mergen <imeevma@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: Fix UPDATE for types unknown to SQL.
Date: Mon, 15 Jul 2019 16:32:08 +0300	[thread overview]
Message-ID: <598DA602-A524-48B9-8D15-78E67A61852B@tarantool.org> (raw)
In-Reply-To: <09286d9d-870b-f5dd-f328-56d374173160@tarantool.org>



> On 9 Jul 2019, at 12:14, Imeev Mergen <imeevma@tarantool.org> wrote:
> 
> Hi! Thank you for review. My answer below.
> 
> On 7/8/19 4:32 PM, n.pettik wrote:
>> 
>>> Diff:
>>> 
>>> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
>>> index f8cf1af..79232de 100644
>>> --- a/src/box/sql/vdbe.c
>>> +++ b/src/box/sql/vdbe.c
>>> @@ -351,19 +351,22 @@ mem_apply_type(struct Mem *record, enum field_type type)
>>> 		return 0;
>>> 	case FIELD_TYPE_SCALAR:
>>> 		/* Can't cast MAP and ARRAY to scalar types. */
>>> -		if (record->subtype == SQL_SUBTYPE_MSGPACK) {
>>> +		if ((record->flags & MEM_Blob) == MEM_Blob &&
>> 
>> Why do you need this additional check on MEM_Blob?
>> Is it possible that memory holds raw msgpack and its
>> type not blob? If so, please provide an example.
>> 
> I'm not sure what you describe is possible. But it is impossible
> to say what type MEM has when you look at the SUBTYPE. At the same
> time, the subtype has any meaning only for BLOBs. Any other type
> has any SUBTYPE, and it is not checked anywhere. So, to avoid an
> error, when something, for example INT, throws an error when
> casting to SCALAR, I added these checks.

Ok, but then I guess more appropriate solution would be
checking MEM_Subtype flag, instead of MEM_Blob
Anyway, I would add clear test which reaches this path
and record->flags != MEM_Blob, but ->subtype == msgpack.

  reply	other threads:[~2019-07-15 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 15:34 [tarantool-patches] " imeevma
2019-07-01 23:29 ` [tarantool-patches] " n.pettik
2019-07-08 10:13   ` Mergen Imeev
2019-07-08 13:32     ` n.pettik
2019-07-09  9:14       ` Imeev Mergen
2019-07-15 13:32         ` n.pettik [this message]
2019-07-16 14:19           ` Mergen Imeev
2019-07-18 15:59             ` n.pettik

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=598DA602-A524-48B9-8D15-78E67A61852B@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: Fix UPDATE for types unknown to SQL.' \
    /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