Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6f56458a
Commit
6f56458a
authored
Mar 19, 2021
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-25183 JSON_TABLE: CREATE VIEW involving NESTED PATH ends up with invalid frm.
Wrong comma was added after the single column.
parent
51ac57fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
mysql-test/suite/json/r/json_table.result
mysql-test/suite/json/r/json_table.result
+11
-0
mysql-test/suite/json/t/json_table.test
mysql-test/suite/json/t/json_table.test
+8
-0
sql/json_table.cc
sql/json_table.cc
+8
-9
No files found.
mysql-test/suite/json/r/json_table.result
View file @
6f56458a
...
...
@@ -505,5 +505,16 @@ hex(a) b
626172 2
SET @@character_set_connection= @old_character_set_connection;
#
# MDEV-25183 JSON_TABLE: CREATE VIEW involving NESTED PATH ends up with invalid frm
#
CREATE VIEW v AS SELECT * FROM JSON_TABLE('{}', '$' COLUMNS(NESTED PATH '$**.*' COLUMNS(a FOR ORDINALITY), b VARCHAR(8) PATH '$')) AS jt;
SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `jt`.`a` AS `a`,`jt`.`b` AS `b` from JSON_TABLE('{}', '$' COLUMNS (NESTED PATH '$**.*' COLUMNS (`a` FOR ORDINALITY), `b` varchar(8) PATH '$')) `jt` latin1 latin1_swedish_ci
SELECT * FROM v;
a b
NULL NULL
DROP VIEW v;
#
# End of 10.6 tests
#
mysql-test/suite/json/t/json_table.test
View file @
6f56458a
...
...
@@ -387,6 +387,14 @@ SET @@character_set_connection= utf8;
select
hex
(
a
),
b
from
json_table
(
'["foo","bar"]'
,
'$[*]'
columns
(
a
char
(
3
)
path
'$'
,
b
for
ordinality
))
t
;
SET
@@
character_set_connection
=
@
old_character_set_connection
;
--
echo
#
--
echo
# MDEV-25183 JSON_TABLE: CREATE VIEW involving NESTED PATH ends up with invalid frm
--
echo
#
CREATE
VIEW
v
AS
SELECT
*
FROM
JSON_TABLE
(
'{}'
,
'$'
COLUMNS
(
NESTED
PATH
'$**.*'
COLUMNS
(
a
FOR
ORDINALITY
),
b
VARCHAR
(
8
)
PATH
'$'
))
AS
jt
;
SHOW
CREATE
VIEW
v
;
SELECT
*
FROM
v
;
DROP
VIEW
v
;
--
echo
#
--
echo
# End of 10.6 tests
--
echo
#
sql/json_table.cc
View file @
6f56458a
...
...
@@ -1220,7 +1220,8 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
if
(
str
->
append
(
"COLUMNS ("
))
return
1
;
do
/* loop while jc belongs to the current or nested paths. */
while
(
jc
&&
(
jc
->
m_nest
==
c_path
||
jc
->
m_nest
==
c_nested
))
{
if
(
first_column
)
first_column
=
FALSE
;
...
...
@@ -1231,23 +1232,21 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
{
if
(
jc
->
print
(
thd
,
*
f
,
str
))
return
1
;
if
(
!
(
jc
=
it
++
))
goto
exit_ok
;
++
(
*
f
);
if
((
jc
=
it
++
))
++
(
*
f
);
}
else
if
(
jc
->
m_nest
==
c_nested
)
else
{
DBUG_ASSERT
(
jc
->
m_nest
==
c_nested
);
if
(
str
->
append
(
"NESTED PATH "
)
||
print_path
(
str
,
&
jc
->
m_nest
->
m_path
)
||
str
->
append
(
' '
)
||
c_nested
->
print
(
thd
,
f
,
str
,
it
,
&
jc
))
return
1
;
c_nested
=
c_nested
->
m_next_nested
;
}
else
break
;
}
while
(
jc
);
}
exit_ok:
if
(
str
->
append
(
")"
))
return
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment