Details
-
New Feature
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
Are there any plans to implement a distinct data type for JSON?
It is mentioned in the old issue MDEV-32888 but the issue itself is closed.
> In the newer SQL Standard, as far as I know, they've changed their minds, and wrote that there is a distinct data type for JSON. We'll need to implement that to be standard compatible again and then the behavior will be much more intuitive.
The current implementation of the JSON data type as an alias for LONGTEXT causes issues with Ruby on Rails ActiveRecord ORM. It has its own JSON data type for database columns and can create JSON columns in MariaDB, but afterwards, it derives data types from the information reported by the database at runtime, so it gets confused when the database reports data type as LONGTEXT for JSON columns. In such cases, ActiveRecord returns the data from the column as a String when the app expects an array or hash deserialized from JSON, and on writing to the column, it uses the default YAML serialization instead of JSON and fails CHECK json_valid().
As a result of these failures, I get the following quotes from some developers: "MariaDB does not natively support JSON" (see https://github.com/rails/rails/issues/44997) or "JSON is not inherently included in the basic SQL standard, but it is part of the SQL:2016 standard (ISO/IEC 9075:2016), which MariaDB does not support" (a communication with a 3rd party software vendor).
Attachments
Issue Links
- relates to
-
MDEV-32888 Inconsistent results involving JSON operations
-
- Closed
-
- links to