[MDEV-18323] Convert MySQL JSON type to MariaDB TEXT in mysql_upgrade Created: 2019-01-21 Updated: 2020-11-02 Resolved: 2020-10-28 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Data Manipulation - Update, Data types, Server |
| Fix Version/s: | 10.5.7 |
| Type: | Task | Priority: | Major |
| Reporter: | Anel Husakovic | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
ProblemIf you have MySQL (5.7) table with JSON field/data and you want to select data in MariaDB you will not be able to see the data. Reason for this is that MariaDB currently doesn't support reading the MySQL table with JSON data (server will not crash but rather inform you mysqld: Incorrect information in file: './<schema>/<mysql-table>.frm') because JSON type is native type in MySQL and JSON type is alias for longtext type, what is relevant to SQL standard. Another reason is that JSON type is treated as enum_type (245) what is the same as MYSQL_TYPE_VIRTUAL (which is not enum type - defined in "include/mysql_com.h"). To reproduce this type error do the following:
SolutionIn order to prevent this behaviour, server should be able :
Relevant parts of the code:[1] Error raised: open_table_def() |
| Comments |
| Comment by Anel Husakovic [ 2019-01-22 ] | ||||||
|
Reproduce the error: | ||||||
| Comment by Anel Husakovic [ 2019-02-03 ] | ||||||
|
Add field_mysql_json treated as a field_blob and change the test respectively
As a result one can read data but there are not well reproduced, need to add mysql api for this purpose in next commit | ||||||
| Comment by Anel Husakovic [ 2019-02-04 ] | ||||||
|
First version of mysql_api, still returns the same as above, since `parse_binary` is not correct | ||||||
| Comment by Anel Husakovic [ 2019-02-13 ] | ||||||
|
Added MySQL JSON API in this branch which is my working version https://github.com/an3l/server/commits/new-fix
Todos:
| ||||||
| Comment by Vicențiu Ciorbaru [ 2020-01-14 ] | ||||||
|
serg Patch is here: https://github.com/MariaDB/server/commit/547b70380b760d3c4ae78d00621a1abca4814b6d |