revision-id: 40917878aee8cabe12a1588e9e006024f3e54a9e (mariadb-10.5.2-479-g40917878aee) parent(s): 8b533cc1d5d85137fa3225a6b11e2c59d85439a0 author: Sergei Petrunia committer: Sergei Petrunia timestamp: 2021-03-16 16:15:06 +0300 message: MDEV-25142: JSON_TABLE: CREATE VIEW involving EXISTS PATH ends up with invalid frm --- mysql-test/suite/json/t/json_table.test | 11 +++++++++++ sql/json_table.cc | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 03cc19ad72c..435ac02928a 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -372,6 +372,17 @@ from drop table t20,t21,t31,t32; +--echo # +--echo # MDEV-25142: JSON_TABLE: CREATE VIEW involving EXISTS PATH ends up with invalid frm +--echo # +--disable_warnings +drop view if exists v1; +--enable_warnings + +CREATE VIEW v1 AS SELECT * FROM JSON_TABLE('[]', '$' COLUMNS (f INT EXISTS PATH '$')) a ; +show create view v1; +drop view v1; + --echo # --echo # End of 10.6 tests --echo # diff --git a/sql/json_table.cc b/sql/json_table.cc index a7bad26cfc6..f8b97a627f8 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -982,7 +982,7 @@ int Json_table_column::print(THD *thd, Field **f, String *str) (*f)->sql_type(column_type); if (str->append(column_type) || - str->append(m_column_type == PATH ? " PATH " : " EXISTS ") || + str->append(m_column_type == PATH ? " PATH " : " EXISTS PATH ") || print_path(str, &m_path)) return 1; break;