Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-38740

Implement a distinct data type for JSON

    XMLWordPrintable

Details

    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

          Activity

            People

              Unassigned Unassigned
              AlexD Alex L. Demidov
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.