maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #04695
JSON in MariaDB 10.2.7 and MySQL
-- MariaDB 10.2.7
CREATE TABLE `jsontst`( `id` INT NOT NULL AUTO_INCREMENT, `str` JSON,
PRIMARY KEY (`id`) ) ENGINE=Aria CHARSET=latin1;
SHOW CREATE TABLE `jsontst`;
/* returns
CREATE TABLE `jsontst2` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`str` text DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1
*/
readings:
https://jira.mariadb.org/browse/MDEV-9144
https://bugs.mysql.com/bug.php?id=86875
As you see except for JSON in MariaDB just being a synonym of TEXT there
are two more significant differences
1) length: in MySQL JSON has the lenght of a LONGTEXT - in MariaDB it is a
(plain) TEXT
2) encoding: in MySQL the utf8mb4 character set is enforced for JSON data -
in MariaDB you may specify any character set.
I think in particular 2nd point could cause problems (unicode garbling)
when loading a dump with JSON data from MySQL. Basically because latin1 is
still default character set in MariaDB.
Are you aware of the 2 differences? I think the major reason for
introducing JSON in MariaDB is compability concerns with MySQL. But the 2
points here are IMO incompabilites that could have been avoided?
Follow ups