XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2
    • Fix Version/s: 10.2
    • Component/s: JSON
    • Labels:
      None
    • Sprint:
      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

          Activity

            People

            Assignee:
            holyfoot Alexey Botchkov
            Reporter:
            Andrej Thomsen Andrej Thomsen
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Dates

              Created:
              Updated: