Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.2, 10.3, 10.4, 10.5, 10.6
-
None
Description
This is a query from json_no_table.test. The test runs it with utf8, and it works as it says. However, with latin1 it fails to avoid truncation:
SET NAMES 'latin1'; |
SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE; |
10.2 c6d0531c |
MariaDB [test]> SET NAMES 'latin1'; |
Query OK, 0 rows affected (0.000 sec) |
|
MariaDB [test]> SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE; |
+-----------------+ |
| field1 |
|
+-----------------+ |
| This is a strin | |
+-----------------+ |
1 row in set (0.000 sec) |
|
MariaDB [test]> SET NAMES utf8; |
Query OK, 0 rows affected (0.000 sec) |
|
MariaDB [test]> SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE; |
+-----------------------------------------------+ |
| field1 |
|
+-----------------------------------------------+ |
| This is a string that should not be truncated | |
+-----------------------------------------------+ |
1 row in set (0.001 sec) |
Reproducible on 10.2-10.6.
MySQL returns the full string regardless the character set:
MySQL 8.0.23 |
MySQL [test]> SET NAMES 'latin1'; |
Query OK, 0 rows affected (0.000 sec) |
|
MySQL [test]> SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE; |
+-----------------------------------------------+ |
| field1 |
|
+-----------------------------------------------+ |
| This is a string that should not be truncated | |
+-----------------------------------------------+ |
1 row in set (0.001 sec) |
|
MySQL [test]> SET NAMES utf8; |
Query OK, 0 rows affected, 1 warning (0.000 sec) |
|
MySQL [test]> SELECT * FROM (SELECT JSON_UNQUOTE("This is a string that should not be truncated") AS field1) AS DERIVED_TABLE; |
+-----------------------------------------------+ |
| field1 |
|
+-----------------------------------------------+ |
| This is a string that should not be truncated | |
+-----------------------------------------------+ |
1 row in set (0.001 sec) |