From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 6977022695 for ; Mon, 8 Jul 2019 09:32:33 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pXbHS-N1IGMv for ; Mon, 8 Jul 2019 09:32:33 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 67CFE2142C for ; Mon, 8 Jul 2019 09:32:32 -0400 (EDT) From: "n.pettik" Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_C434F78F-2FA5-4DF7-8E50-CC03FED4E62B" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) 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 In-Reply-To: <20190708101336.GA10686@tarantool.org> References: <132ca83597d0e9c2b4ef75bc8f0d03d22cdf27dd.1561736006.git.imeevma@gmail.com> <20190708101336.GA10686@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: Imeev Mergen --Apple-Mail=_C434F78F-2FA5-4DF7-8E50-CC03FED4E62B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > Diff: >=20 > 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 =3D=3D SQL_SUBTYPE_MSGPACK) { > + if ((record->flags & MEM_Blob) =3D=3D 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 =3D=3D SQL_SUBTYPE_MSGPACK) { > assert(mp_typeof(*record->z) =3D=3D MP_MAP || > mp_typeof(*record->z) =3D=3D MP_ARRAY); > return -1; > } > return 0; > case FIELD_TYPE_MAP: > - if (record->subtype =3D=3D SQL_SUBTYPE_MSGPACK && > + if ((record->flags & MEM_Blob) =3D=3D MEM_Blob && > + record->subtype =3D=3D SQL_SUBTYPE_MSGPACK && > mp_typeof(*record->z) =3D=3D MP_MAP) > return 0; > return -1; > case FIELD_TYPE_ARRAY: > - if (record->subtype =3D=3D SQL_SUBTYPE_MSGPACK && > + if ((record->flags & MEM_Blob) =3D=3D MEM_Blob && > + record->subtype =3D=3D SQL_SUBTYPE_MSGPACK && > mp_typeof(*record->z) =3D=3D MP_ARRAY) > return 0; > return -1; --Apple-Mail=_C434F78F-2FA5-4DF7-8E50-CC03FED4E62B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
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 =3D=3D SQL_SUBTYPE_MSGPACK) {
+ if ((record->flags & MEM_Blob) =3D=3D 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 =3D=3D SQL_SUBTYPE_MSGPACK) {
= assert(mp_typeof(*record->z) =3D=3D MP_MAP ||
=       = ; mp_typeof(*record->z) =3D=3D MP_ARRAY);
= return = -1;
= }
return 0;
= case = FIELD_TYPE_MAP:
- = if = (record->subtype =3D=3D SQL_SUBTYPE_MSGPACK &&
+ if ((record->flags & MEM_Blob) =3D=3D MEM_Blob = &&
+     record->= subtype =3D=3D SQL_SUBTYPE_MSGPACK &&
    mp_typeof(*= record->z) =3D=3D MP_MAP)
= return 0;
= return = -1;
case FIELD_TYPE_ARRAY:
- = if = (record->subtype =3D=3D SQL_SUBTYPE_MSGPACK &&
+ if ((record->flags & MEM_Blob) =3D=3D MEM_Blob = &&
+     record->= subtype =3D=3D SQL_SUBTYPE_MSGPACK &&
    mp_typeof(*= record->z) =3D=3D MP_ARRAY)
= return 0;
= return = -1;

= --Apple-Mail=_C434F78F-2FA5-4DF7-8E50-CC03FED4E62B--