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

Konstantin Osipov kostja at tarantool.org
Thu Jul 25 01:37:06 MSK 2019


* 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? Soon we will be
able to work with these values in SQL queries, so we simply need
to make sure we can pass them around expression trees for now?

-- 
Konstantin Osipov, Moscow, Russia




More information about the Tarantool-patches mailing list