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

JSON_ARRAY_APPEND

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2, 10.3, 10.3.9
    • Fix Version/s: 10.2.18
    • Component/s: JSON
    • Labels:
      None
    • Environment:
      Ubuntu 18.04

      Description

      CREATE TEMPORARY TABLE a (
        `data` mediumtext DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
       
      INSERT INTO a VALUES ('{}');
       
      UPDATE a SET 
        data = JSON_INSERT(data, '$.messages', JSON_QUERY('[]', '$')) ,
        data = JSON_ARRAY_APPEND(data, '$.messages', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$'));
       
      -- Error (4038): Syntax error in JSON text in argument 1 to function 'json_array_append' at position 15
       
      -- BUT, If in "JSON_QUERY('[]', '$'))" array is not empty:
       
      UPDATE a SET 
        data = JSON_INSERT(data, '$.messages', JSON_QUERY('["AAAAA"]', '$')) ,
        data = JSON_ARRAY_APPEND(data, '$.messages', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$'));
       
      -- Not errors
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              alekseymvt Aleksey M.
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: