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

JSON_SET returns NULL instead of object

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL)
    • 10.2.9
    • JSON
    • None

    Description

      In MySQL 5.7:

      SELECT JSON_SET('{}', '$.age', 87); 
      +-----------------------------+
      | JSON_SET('{}', '$.age', 87) |
      +-----------------------------+
      | {"age": 87}                 |
      +-----------------------------+
      

      In MariaDB 10.2:

      SELECT JSON_SET('{}', '$.age', 87); 
      +-----------------------------+
      | JSON_SET('{}', '$.age', 87) |
      +-----------------------------+
      | NULL                        |
      +-----------------------------+
      

      Attachments

        Issue Links

          Activity

            alice Alice Sherepa added a comment -

            reproduced on 10.2.7

            SELECT JSON_SET('{}', '$.age', 87)
            +-----------------------------+
            | JSON_SET('{}', '$.age', 87) |
            +-----------------------------+
            | NULL                        |
            +-----------------------------+
            1 row in set, 1 warning (0.00 sec)
            Warning (Code 4038): Syntax error in JSON text in argument 1 to function 'json_set' at position 2
             
            MariaDB [test]> SELECT JSON_VALID('{}');
            --------------
            SELECT JSON_VALID('{}')
            +------------------+
            | JSON_VALID('{}') |
            +------------------+
            |                1 |
            +------------------+
            1 row in set (0.00 sec)
            
            

            alice Alice Sherepa added a comment - reproduced on 10.2.7 SELECT JSON_SET( '{}' , '$.age' , 87) + -----------------------------+ | JSON_SET( '{}' , '$.age' , 87) | + -----------------------------+ | NULL | + -----------------------------+ 1 row in set , 1 warning (0.00 sec) Warning (Code 4038): Syntax error in JSON text in argument 1 to function 'json_set' at position 2   MariaDB [test]> SELECT JSON_VALID( '{}' ); -------------- SELECT JSON_VALID( '{}' ) + ------------------+ | JSON_VALID( '{}' ) | + ------------------+ | 1 | + ------------------+ 1 row in set (0.00 sec)
            StevenWdV Steven WdV added a comment -

            Confirmed for MariaDB 10.3.1 Alpha, an other example would be:

            SELECT JSON_ARRAY_APPEND('[]', '$', 42)
            --returns NULL, should return '[42]'
            

            Also, the Issue Links section states this issue duplicates MDEV-13323, while it should be is duplicated by MDEV-13323

            StevenWdV Steven WdV added a comment - Confirmed for MariaDB 10.3.1 Alpha, an other example would be: SELECT JSON_ARRAY_APPEND( '[]' , '$' , 42) --returns NULL, should return '[42]' Also, the Issue Links section states this issue duplicates MDEV-13323 , while it should be is duplicated by MDEV-13323

            People

              holyfoot Alexey Botchkov
              greenman Ian Gilfillan
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.