[MDEV-19952] SHOW CREATE VIEW incorrectly emits JSON_MERGE as JSON_MERGE_PRESERVE Created: 2019-07-04  Updated: 2022-06-01

Status: Open
Project: MariaDB Server
Component/s: JSON, Views
Affects Version/s: 10.3.16
Fix Version/s: 10.3

Type: Bug Priority: Major
Reporter: Stuart Longland Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: regression
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.


Generated at Thu Feb 08 08:55:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.