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

IF and COALESCE lose "json" property

    XMLWordPrintable

    Details

      Description

      MariaDB [test]> select json_object('a', json_object('b', 'c'));
      +-----------------------------------------+
      | json_object('a', json_object('b', 'c')) |
      +-----------------------------------------+
      | {"a": {"b": "c"}}                       |
      +-----------------------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> select json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f')));
      +-----------------------------------------------------------------------+
      | json_object('a', if(1, json_object('b', 'c'), json_object('e', 'f'))) |
      +-----------------------------------------------------------------------+
      | {"a": "{\"b\": \"c\"}"}                                               |
      +-----------------------------------------------------------------------+
      1 row in set (0.001 sec)
       
      MariaDB [test]> select json_object('a', coalesce(json_object('b', 'c')));
      +---------------------------------------------------+
      | json_object('a', coalesce(json_object('b', 'c'))) |
      +---------------------------------------------------+
      | {"a": "{\"b\": \"c\"}"}                           |
      +---------------------------------------------------+
      1 row in set (0.000 sec)
      

      other functions (CASE, NULLIF, IFNULL) are likely affected too.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              serg Sergei Golubchik
              Votes:
              2 Vote for this issue
              Watchers:
              8 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.