MariaDB [test]> create table t1 (name varchar(30), n1 varchar(30) GENERATED ALWAYS AS (json_unquote(json_extract(`name`,'$.en'))) virtual) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
Query OK, 0 rows affected (0.049 sec)
|
|
MariaDB [test]> show create table t1;
|
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`name` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
`n1` varchar(30) COLLATE utf8mb4_unicode_ci GENERATED ALWAYS AS (json_unquote(json_extract(`name`,'$.en'))) VIRTUAL
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
|
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
1 row in set (0.004 sec)
|
|
MariaDB [test]> set names 'utf8mb4' collate utf8mb4_unicode_ci;
|
Query OK, 0 rows affected (0.001 sec)
|
|
MariaDB [test]> create table t2 (name varchar(30), n1 varchar(30) GENERATED ALWAYS AS (json_unquote(json_extract(`name`,'$.en'))) COLLATE utf8mb4_unicode_ci);
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COLLATE utf8mb4_unicode_ci)' at line 1
|
|
MariaDB [test]> create table t2 (name varchar(30), n1 varchar(30) GENERATED ALWAYS AS ((json_unquote(json_extract(`name`,'$.en'))) COLLATE utf8mb4_unicode_ci));
|
ERROR 1253 (42000): COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8'
|
Error (Code 1253): COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8'
|
Error (Code 4027): Got an error evaluating stored expression json_unquote(json_extract(`name`,'$.en')) collate utf8mb4_unicode_ci
|
MariaDB [test]> show variables like 'char%';
|
+--------------------------+----------------------------------+
|
| Variable_name | Value |
|
+--------------------------+----------------------------------+
|
| character_set_client | utf8mb4 |
|
| character_set_connection | utf8mb4 |
|
| character_set_database | utf8mb4 |
|
| character_set_filesystem | binary |
|
| character_set_results | utf8mb4 |
|
| character_set_server | utf8mb4 |
|
| character_set_system | utf8 |
|
| character_sets_dir | /usr/local/mysql/share/charsets/ |
|
+--------------------------+----------------------------------+
|
8 rows in set (0.007 sec)
|
|