[tarantool-patches] Re: [PATCH v2 2/2] sql: fix error in case ARRAY/MAP converted to SCALAR

n.pettik korablev at tarantool.org
Thu Jul 25 02:30:12 MSK 2019



> On 25 Jul 2019, at 01:37, Konstantin Osipov <kostja at tarantool.org> wrote:
> 
> * n.pettik <korablev at tarantool.org> [19/07/24 17:03]:
>>> 		assert(memIsValid(pIn1));
>>> 		if (mem_apply_type(pIn1, type) != 0) {
>>> -			diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
>>> -				 sql_value_text(pIn1),
>>> +			const char *value;
>>> +			if ((pIn1->flags & MEM_Subtype) != 0 &&
>>> +			    pIn1->subtype == SQL_SUBTYPE_MSGPACK) {
>>> +				if (mp_typeof(*pIn1->z) == MP_MAP)
>>> +					value = "map";
>>> +				else
>>> +					value = "array";
>>> +			} else {
>>> +				value = (const char *)sql_value_text(pIn1);
>> 
>> 
>> Why not simply patch sql_value_text() to make it convert
>> map/array to string representation? I’m afraid this is
>> unlikely to be the only place where such error may occur.
> 
> Perhaps I am missing the context, but because we don't want to 
> implicitly convert these values to text in SQL?

It’s not about implicit conversion, it’s only about text representation
(like mp_fprint()).

> Soon we will be able to work with these values in SQL queries,

It’s extremely doubtful statement.

> so we simply need
> to make sure we can pass them around expression trees for now?

Actually, we can’t now.

> 
> -- 
> Konstantin Osipov, Moscow, Russia
> 





More information about the Tarantool-patches mailing list