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, 8 Jul 2019 16:32:30 +0300	[thread overview]
Message-ID: <B9AF5233-639F-4A6F-BC2B-23949037ADDB@tarantool.org> (raw)
In-Reply-To: <20190708101336.GA10686@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 1306 bytes --]


> 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.

> +		    record->subtype == SQL_SUBTYPE_MSGPACK) {
> 			assert(mp_typeof(*record->z) == MP_MAP ||
> 			       mp_typeof(*record->z) == MP_ARRAY);
> 			return -1;
> 		}
> 		return 0;
> 	case FIELD_TYPE_MAP:
> -		if (record->subtype == SQL_SUBTYPE_MSGPACK &&
> +		if ((record->flags & MEM_Blob) == MEM_Blob &&
> +		    record->subtype == SQL_SUBTYPE_MSGPACK &&
> 		    mp_typeof(*record->z) == MP_MAP)
> 			return 0;
> 		return -1;
> 	case FIELD_TYPE_ARRAY:
> -		if (record->subtype == SQL_SUBTYPE_MSGPACK &&
> +		if ((record->flags & MEM_Blob) == MEM_Blob &&
> +		    record->subtype == SQL_SUBTYPE_MSGPACK &&
> 		    mp_typeof(*record->z) == MP_ARRAY)
> 			return 0;
> 		return -1;


[-- Attachment #2: Type: text/html, Size: 46669 bytes --]

  reply	other threads:[~2019-07-08 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 [this message]
2019-07-09  9:14       ` Imeev Mergen
2019-07-15 13:32         ` n.pettik
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=B9AF5233-639F-4A6F-BC2B-23949037ADDB@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