[tarantool-patches] Re: [PATCH v1 1/1] sql: Fix UPDATE for types unknown to SQL.

n.pettik korablev at tarantool.org
Mon Jul 8 16:32:30 MSK 2019


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190708/8968a257/attachment.html>


More information about the Tarantool-patches mailing list