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

SHOW CREATE VIEW incorrectly emits JSON_MERGE as JSON_MERGE_PRESERVE

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.3.16
    • Fix Version/s: 10.3
    • Component/s: JSON, Views
    • Labels:
      None
    • Environment:
      MariaDB 10.3.16 on Debian Linux 9 (AMD64)

      Description

      On MariaDB 10.3.13 running on Gentoo AMD64… creating a view which references JSON_MERGE works as expected:

      MariaDB [test]> create view testview as select json_merge('{"key1":"val1"}','{"key2":"val2"}') as testcol;
      Query OK, 0 rows affected (0.006 sec)
       
      MariaDB [test]> show create view testview;
      +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      | View     | Create View                                                                                                                                                       | character_set_client | collation_connection |
      +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      | testview | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testview` AS select json_merge('{"key1":"val1"}','{"key2":"val2"}') AS `testcol` | utf8                 | utf8_general_ci      |
      +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      1 row in set (0.000 sec)
      

      Do the same on 10.3.16 on Debian 9 (AMD64), I get this:

      MariaDB [test]> create view testview as select json_merge('{"key1":"val1"}','{"key2":"val2"}') as testcol;
      Query OK, 0 rows affected (0.006 sec)
       
      MariaDB [test]> show create view testview;
      +----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      | View     | Create View                                                                                                                                                                | character_set_client | collation_connection |
      +----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      | testview | CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testview` AS select json_merge_preserve('{"key1":"val1"}','{"key2":"val2"}') AS `testcol` | utf8mb4              | utf8mb4_general_ci   |
      +----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------+----------------------+
      1 row in set (0.001 sec)
      

      The json_merge_preserve also appears in mysqldump and this causes restoring the dump to fail.

        Attachments

          Activity

            People

            • Assignee:
              holyfoot Alexey Botchkov
              Reporter:
              sjlongland Stuart Longland
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: