[Tarantool-patches] [PATCH v2 2/4] sql: properly show values in type mismatch error

Mergen Imeev imeevma at tarantool.org
Mon Jul 12 11:56:08 MSK 2021


Hi! Thank you for the review! My answer below.

On Thu, Jul 08, 2021 at 12:09:57AM +0200, Vladislav Shpilevoy wrote:
> Thanks for the patch!
> 
> > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> > index 630f1a135..728d3c9a7 100644
> > --- a/src/box/sql/mem.c
> > +++ b/src/box/sql/mem.c
> > @@ -80,9 +80,11 @@ mem_str(const struct Mem *mem)
> >                 if (mem->n > STR_VALUE_MAX_LEN) {
> >                         memcpy(buf, mem->z, STR_VALUE_MAX_LEN);
> >                         buf[STR_VALUE_MAX_LEN] = '\0';
> > -                       return tt_sprintf("%s...", buf);
> > +                       return tt_sprintf("'%s...", buf);
> 
> Why didn't you put a second ' after ...? The error message
> does not end here. There are more words after this string usually.
> The same below.
> 
I belive that "'" is actually part of value. This way we will get inconsistent
value in case only part of it was printed. This is similar for what we do with
array - in case it is too long we will not close it using "]".

Same for varbinary.

> > @@ -102,7 +115,8 @@ mem_str(const struct Mem *mem)
> >                 return tt_sprintf("%s...", buf);
> >         }
> >         case MEM_TYPE_UUID:
> > -               return tt_uuid_str(&mem->u.uuid);
> > +               tt_uuid_to_string(&mem->u.uuid, buf);
> > +               return tt_sprintf("'%s'", buf);
> >         case MEM_TYPE_BOOL:
> >                 return mem->u.b ? "TRUE" : "FALSE";
> >         default:


More information about the Tarantool-patches mailing list