File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ json_quote('foo')
297
297
show create table t1;
298
298
Table Create Table
299
299
t1 CREATE TABLE `t1` (
300
- `json_quote('foo')` varchar(10 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
300
+ `json_quote('foo')` varchar(38 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
301
301
) ENGINE=MyISAM DEFAULT CHARSET=latin1
302
302
drop table t1;
303
303
select json_merge('string');
@@ -747,3 +747,16 @@ INSERT INTO t1 VALUES ('foo'),('bar');
747
747
SELECT * FROM t1 WHERE c IN (JSON_EXTRACT('{"a":"b"}', '$.*'));
748
748
c
749
749
DROP TABLE t1;
750
+ #
751
+ # MDEV-16814 CREATE TABLE SELECT JSON_QUOTE(multibyte_charset_expr) makes a field of a wrong length
752
+ #
753
+ CREATE TABLE t1 AS SELECT
754
+ JSON_QUOTE(_latin1'foo') AS c1,
755
+ JSON_QUOTE(_utf8'foo') AS c2;
756
+ SHOW CREATE TABLE t1;
757
+ Table Create Table
758
+ t1 CREATE TABLE `t1` (
759
+ `c1` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
760
+ `c2` varchar(38) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
761
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
762
+ DROP TABLE t1;
Original file line number Diff line number Diff line change @@ -413,3 +413,12 @@ INSERT INTO t1 VALUES ('foo'),('bar');
413
413
SELECT * FROM t1 WHERE c IN (JSON_EXTRACT('{"a":"b"}', '$.*'));
414
414
DROP TABLE t1;
415
415
416
+ --echo #
417
+ --echo # MDEV-16814 CREATE TABLE SELECT JSON_QUOTE(multibyte_charset_expr) makes a field of a wrong length
418
+ --echo #
419
+
420
+ CREATE TABLE t1 AS SELECT
421
+ JSON_QUOTE(_latin1'foo') AS c1,
422
+ JSON_QUOTE(_utf8'foo') AS c2;
423
+ SHOW CREATE TABLE t1;
424
+ DROP TABLE t1;
Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ bool Item_func_json_quote::fix_length_and_dec()
575
575
Odd but realistic worst case is when all characters
576
576
of the argument turn into '\uXXXX\uXXXX', which is 12.
577
577
*/
578
- max_length= args[0 ]->max_length * 12 + 2 ;
578
+ fix_char_length_ulonglong ((ulonglong) args[0 ]->max_char_length () * 12 + 2 ) ;
579
579
return FALSE ;
580
580
}
581
581
You can’t perform that action at this time.
0 commit comments