← Back to team overview

maria-developers team mailing list archive

MDEV-17399: default value is truncated


Hi Alexey,

On Fri, Jan 29, 2021 at 10:42:59AM +0400, Alexey Botchkov wrote:
> Some updates were pushed.
> See here for the review.
> https://github.com/MariaDB/server/commit/d7ff97bd1343a94430152389f90c4d08f56fce44
First input:

MariaDB [(none)]> 
  SELECT x, length(x) 
    JSON_TABLE('{}', '$' COLUMNS (x VARCHAR(10) PATH '$.x' DEFAULT 'abcdefg' ON EMPTY)) jt;
| x    | length(x) |
| abc  |         3 |
1 row in set (0.000 sec)

Using VARACHAR(12) produces "abcd", so it seems the truncation length is one
third of the N in VARCHAR(N).

Is this utf8 characters vs bytes error somewhere? Please fix.

Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://petrunia.net