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

JSON in CTEs sometimes get broken

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.5.12
    • Fix Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
    • Component/s: JSON, Optimizer - CTE
    • Labels:
      None
    • Environment:
      MariaDB in a docker container

      Description

      When certain JSON expressions are wrapped into a non-recursive CTE, the resulting JSON is broken:

      MariaDB [test]> SELECT JSON_SET('{"a": 1}', '$.b', 1) doc;
      +------------------+
      | doc              |
      +------------------+
      | {"a": 1, "b": 1} |
      +------------------+
      1 row in set (0.000 sec)
       
      MariaDB [test]> WITH js AS (SELECT JSON_SET('{"a": 1}', '$.b', 1) doc) SELECT doc FROM js;
      +-----------------+
      | doc             |
      +-----------------+
      | {"a": 1, "b": 1 |
      +-----------------+
      1 row in set (0.000 sec)
      

      So far I've only managed to reproduce this with JSON_SET.

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            markus makela markus makela
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration