XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6
    • N/A
    • JSON
    • None
    • 10.2.12, 10.2.14

    Description

      JSON data is not getting recognized, so statements like the following result in broken JSON-strings. In MySQL it doesn't happen because JSON is recognized as a datatype. If adding JSON as a datatype is not an option to consider, then maybe add an optional parameter to "JSON_OBJECT()" to check the passed attributes to not escape them again. When advertising JSON-support in MariaDB 10.2 results in generating those strings manually via "CONCAT()" is not what people expect and this is the only reason I can't use MariaDB in nearly all of my projects.

      Note: If testing in MySQL 5.7, cast the concatenated JSON-value of "Permission" as JSON manually, so it wont be escaped again.

      SELECT
                      JSON_OBJECT(
                          'Staff', JSON_OBJECT(
                              'Staff_ID', Staff_ID,
                              'StaffNumber', Staff_Number,
                              'StaffName', Staff_Name
                          ),
                          'Company', JSON_OBJECT(
                              'Company_ID', Company_ID,
                              'Description', Company_Name
                          ),
                          'Permissions', CONCAT(
                              '[',
                              GROUP_CONCAT(
                                  JSON_OBJECT(Permission_ID, Permission_Flag)
                              ),
                              ']'
                          )
                      ) AS StaffObj
      FROM            Staff
      NATURAL JOIN    Company
      NATURAL JOIN    Staff_Permissions
      GROUP BY        Staff_ID;
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              Andrej Thomsen Andrej Thomsen
              Votes:
              11 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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