Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.3.9, 10.2(EOL), 10.3(EOL)
    • 10.2.18
    • JSON
    • None
    • 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

            alekseymvt Aleksey M. created issue -
            alekseymvt Aleksey M. made changes -
            Field Original Value New Value
            Description {code:sql}
            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

            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
            {code}
            {code:sql}
            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
            {code}
            alekseymvt Aleksey M. made changes -
            Description {code:sql}
            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
            {code}
            * {code:sql}
            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
            {code}
            alekseymvt Aleksey M. made changes -
            Description * {code:sql}
            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
            {code}
            {code:sql}
            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
            {code}
            alice Alice Sherepa added a comment -

            Thanks for the report!
            reproduced as described on MariaDB 10.2, 10.3

            MariaDB [test]> select JSON_ARRAY_APPEND('{"a": []}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) ;
            +--------------------------------------------------------------------------------------------------+
            | JSON_ARRAY_APPEND('{"a": []}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) |
            +--------------------------------------------------------------------------------------------------+
            | NULL                                                                                             |
            +--------------------------------------------------------------------------------------------------+
            1 row in set, 1 warning (0.000 sec)
             
            Warning (Code 4038): Syntax error in JSON text in argument 1 to function 'json_array_append' at position 8
            MariaDB [test]> select JSON_ARRAY_APPEND('{"a": [{}]}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) ;
            +----------------------------------------------------------------------------------------------------+
            | JSON_ARRAY_APPEND('{"a": [{}]}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) |
            +----------------------------------------------------------------------------------------------------+
            | {"a": [{}, {"date": "2018-09-03", "text": "mmmmmmm"}]}                                             |
            +----------------------------------------------------------------------------------------------------+
            1 row in set (0.000 sec)
            

            alice Alice Sherepa added a comment - Thanks for the report! reproduced as described on MariaDB 10.2, 10.3 MariaDB [test]> select JSON_ARRAY_APPEND('{"a": []}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) ; +--------------------------------------------------------------------------------------------------+ | JSON_ARRAY_APPEND('{"a": []}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) | +--------------------------------------------------------------------------------------------------+ | NULL | +--------------------------------------------------------------------------------------------------+ 1 row in set, 1 warning (0.000 sec)   Warning (Code 4038): Syntax error in JSON text in argument 1 to function 'json_array_append' at position 8 MariaDB [test]> select JSON_ARRAY_APPEND('{"a": [{}]}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) ; +----------------------------------------------------------------------------------------------------+ | JSON_ARRAY_APPEND('{"a": [{}]}', '$.a', JSON_QUERY('{"date":"2018-09-03","text":"mmmmmmm"}', '$')) | +----------------------------------------------------------------------------------------------------+ | {"a": [{}, {"date": "2018-09-03", "text": "mmmmmmm"}]} | +----------------------------------------------------------------------------------------------------+ 1 row in set (0.000 sec)
            alice Alice Sherepa made changes -
            Affects Version/s 10.2 [ 14601 ]
            Affects Version/s 10.3 [ 22126 ]
            alice Alice Sherepa made changes -
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            alice Alice Sherepa made changes -
            Component/s JSON [ 13908 ]
            alice Alice Sherepa made changes -
            Assignee Alexey Botchkov [ holyfoot ]
            alice Alice Sherepa made changes -
            alice Alice Sherepa made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            holyfoot Alexey Botchkov made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            holyfoot Alexey Botchkov added a comment - http://lists.askmonty.org/pipermail/commits/2018-September/012907.html
            holyfoot Alexey Botchkov made changes -
            issue.field.resolutiondate 2018-09-11 11:13:07.0 2018-09-11 11:13:07.271
            holyfoot Alexey Botchkov made changes -
            Fix Version/s 10.2.18 [ 23112 ]
            Fix Version/s 10.2 [ 14601 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 89196 ] MariaDB v4 [ 154887 ]

            People

              holyfoot Alexey Botchkov
              alekseymvt Aleksey M.
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.