Commit 11c8ce43 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-25138 JSON_TABLE: A space between JSON_TABLE and opening bracket causes syntax error.

syntax fixed.
parent 0cea1ea7
...@@ -559,5 +559,19 @@ DROP VIEW v; ...@@ -559,5 +559,19 @@ DROP VIEW v;
SELECT val, MATCH(val) AGAINST( 'MariaDB') FROM JSON_TABLE('{"db":"xx"}', '$' COLUMNS(val VARCHAR(32) PATH '$**.*')) AS jt; SELECT val, MATCH(val) AGAINST( 'MariaDB') FROM JSON_TABLE('{"db":"xx"}', '$' COLUMNS(val VARCHAR(32) PATH '$**.*')) AS jt;
ERROR HY000: The storage engine JSON_TABLE function doesn't support FULLTEXT indexes ERROR HY000: The storage engine JSON_TABLE function doesn't support FULLTEXT indexes
# #
# MDEV-25138 JSON_TABLE: A space between JSON_TABLE and opening bracket causes syntax error
#
select * from json_table ('{}', '$' COLUMNS(x FOR ORDINALITY)) a;
x
1
create table json_table(id int);
insert into json_table values (1), (2), (3);
select * from json_table;
id
1
2
3
drop table json_table;
#
# End of 10.6 tests # End of 10.6 tests
# #
...@@ -846,11 +846,11 @@ SET jt1.a=1; ...@@ -846,11 +846,11 @@ SET jt1.a=1;
ERROR HY000: The target table jt1 of the UPDATE is not updatable ERROR HY000: The target table jt1 of the UPDATE is not updatable
DELETE JSON_TABLE(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1 DELETE JSON_TABLE(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1
FROM t1; FROM t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON_TABLE(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1
FROM t1' at line 1 FROM t1' at line 1
DELETE t1, JSON_TABLE(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1 DELETE t1, JSON_TABLE(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1
USING t1; USING t1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JSON_TABLE(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(t1.c1,'$[*]' COLUMNS (a INT PATH '$.a')) AS jt1
USING t1' at line 1 USING t1' at line 1
DROP TABLE t1; DROP TABLE t1;
# #
......
...@@ -437,6 +437,15 @@ DROP VIEW v; ...@@ -437,6 +437,15 @@ DROP VIEW v;
--error ER_TABLE_CANT_HANDLE_FT --error ER_TABLE_CANT_HANDLE_FT
SELECT val, MATCH(val) AGAINST( 'MariaDB') FROM JSON_TABLE('{"db":"xx"}', '$' COLUMNS(val VARCHAR(32) PATH '$**.*')) AS jt; SELECT val, MATCH(val) AGAINST( 'MariaDB') FROM JSON_TABLE('{"db":"xx"}', '$' COLUMNS(val VARCHAR(32) PATH '$**.*')) AS jt;
--echo #
--echo # MDEV-25138 JSON_TABLE: A space between JSON_TABLE and opening bracket causes syntax error
--echo #
select * from json_table ('{}', '$' COLUMNS(x FOR ORDINALITY)) a;
create table json_table(id int);
insert into json_table values (1), (2), (3);
select * from json_table;
drop table json_table;
--echo # --echo #
--echo # End of 10.6 tests --echo # End of 10.6 tests
--echo # --echo #
...@@ -329,6 +329,7 @@ static SYMBOL symbols[] = { ...@@ -329,6 +329,7 @@ static SYMBOL symbols[] = {
{ "INVOKER", SYM(INVOKER_SYM)}, { "INVOKER", SYM(INVOKER_SYM)},
{ "JOIN", SYM(JOIN_SYM)}, { "JOIN", SYM(JOIN_SYM)},
{ "JSON", SYM(JSON_SYM)}, { "JSON", SYM(JSON_SYM)},
{ "JSON_TABLE", SYM(JSON_TABLE_SYM)},
{ "KEY", SYM(KEY_SYM)}, { "KEY", SYM(KEY_SYM)},
{ "KEYS", SYM(KEYS)}, { "KEYS", SYM(KEYS)},
{ "KEY_BLOCK_SIZE", SYM(KEY_BLOCK_SIZE)}, { "KEY_BLOCK_SIZE", SYM(KEY_BLOCK_SIZE)},
...@@ -762,7 +763,6 @@ static SYMBOL sql_functions[] = { ...@@ -762,7 +763,6 @@ static SYMBOL sql_functions[] = {
{ "GROUP_CONCAT", SYM(GROUP_CONCAT_SYM)}, { "GROUP_CONCAT", SYM(GROUP_CONCAT_SYM)},
{ "JSON_ARRAYAGG", SYM(JSON_ARRAYAGG_SYM)}, { "JSON_ARRAYAGG", SYM(JSON_ARRAYAGG_SYM)},
{ "JSON_OBJECTAGG", SYM(JSON_OBJECTAGG_SYM)}, { "JSON_OBJECTAGG", SYM(JSON_OBJECTAGG_SYM)},
{ "JSON_TABLE", SYM(JSON_TABLE_SYM)},
{ "LAG", SYM(LAG_SYM)}, { "LAG", SYM(LAG_SYM)},
{ "LEAD", SYM(LEAD_SYM)}, { "LEAD", SYM(LEAD_SYM)},
{ "MAX", SYM(MAX_SYM)}, { "MAX", SYM(MAX_SYM)},
......
...@@ -15914,6 +15914,7 @@ keyword_sp_var_and_label: ...@@ -15914,6 +15914,7 @@ keyword_sp_var_and_label:
| ISSUER_SYM | ISSUER_SYM
| INSERT_METHOD | INSERT_METHOD
| INVISIBLE_SYM | INVISIBLE_SYM
| JSON_TABLE_SYM
| KEY_BLOCK_SIZE | KEY_BLOCK_SIZE
| LAST_VALUE | LAST_VALUE
| LAST_SYM | LAST_SYM
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment