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
6b6d745b
Commit
6b6d745b
authored
May 30, 2021
by
Alexey Botchkov
Committed by
Rucha Deodhar
May 31, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
let numeric in the DEMAULT.
parent
05d049bd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
5 deletions
+26
-5
mysql-test/suite/json/r/json_table.result
mysql-test/suite/json/r/json_table.result
+2
-2
mysql-test/suite/json/t/json_table.test
mysql-test/suite/json/t/json_table.test
+2
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+22
-1
No files found.
mysql-test/suite/json/r/json_table.result
View file @
6b6d745b
...
@@ -57,14 +57,14 @@ Jeans {"color": "blue", "price": 50} blue
...
@@ -57,14 +57,14 @@ Jeans {"color": "blue", "price": 50} blue
select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(100) path '$.color')) as T on 1;
select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(100) path '$.color')) as T on 1;
ERROR 42S22: Unknown column 't1.item_props' in 'JSON_TABLE argument'
ERROR 42S22: Unknown column 't1.item_props' in 'JSON_TABLE argument'
DROP TABLE t1;
DROP TABLE t1;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default
'101'
on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default
101
on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
a b
a b
101 11
101 11
101 111
101 111
2 22
2 22
2 222
2 222
3 NULL
3 NULL
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default
'202'
on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default
202
on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt;
a b
a b
NULL 11
NULL 11
NULL 111
NULL 111
...
...
mysql-test/suite/json/t/json_table.test
View file @
6b6d745b
...
@@ -30,9 +30,9 @@ select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(
...
@@ -30,9 +30,9 @@ select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(
DROP
TABLE
t1
;
DROP
TABLE
t1
;
select
*
from
JSON_TABLE
(
'[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]'
,
'$[*]'
COLUMNS
(
a
INT
PATH
'$.a'
default
'101'
on
empty
,
NESTED
PATH
'$.b[*]'
COLUMNS
(
b
INT
PATH
'$'
)))
as
jt
;
select
*
from
JSON_TABLE
(
'[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]'
,
'$[*]'
COLUMNS
(
a
INT
PATH
'$.a'
default
101
on
empty
,
NESTED
PATH
'$.b[*]'
COLUMNS
(
b
INT
PATH
'$'
)))
as
jt
;
select
*
from
JSON_TABLE
(
'[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]'
,
'$[*]'
COLUMNS
(
a
INT
PATH
'$.a'
default
'202'
on
error
,
NESTED
PATH
'$.b[*]'
COLUMNS
(
b
INT
PATH
'$'
)))
as
jt
;
select
*
from
JSON_TABLE
(
'[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]'
,
'$[*]'
COLUMNS
(
a
INT
PATH
'$.a'
default
202
on
error
,
NESTED
PATH
'$.b[*]'
COLUMNS
(
b
INT
PATH
'$'
)))
as
jt
;
select
*
from
JSON_TABLE
(
'[ {"a": [1, 2], "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]'
,
'$[*]'
COLUMNS
(
a
INT
PATH
'$.a'
default
'101'
on
empty
,
NESTED
PATH
'$.b[*]'
COLUMNS
(
b
INT
PATH
'$'
)))
as
jt
;
select
*
from
JSON_TABLE
(
'[ {"a": [1, 2], "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]'
,
'$[*]'
COLUMNS
(
a
INT
PATH
'$.a'
default
'101'
on
empty
,
NESTED
PATH
'$.b[*]'
COLUMNS
(
b
INT
PATH
'$'
)))
as
jt
;
...
...
sql/sql_yacc.yy
View file @
6b6d745b
...
@@ -1313,6 +1313,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
...
@@ -1313,6 +1313,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
TEXT_STRING
TEXT_STRING
NCHAR_STRING
NCHAR_STRING
json_text_literal
json_text_literal
json_text_literal_or_num
%type <lex_str_ptr>
%type <lex_str_ptr>
opt_table_alias_clause
opt_table_alias_clause
...
@@ -11570,6 +11571,26 @@ json_text_literal:
...
@@ -11570,6 +11571,26 @@ json_text_literal:
}
}
;
;
json_text_literal_or_num:
json_text_literal
| NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
| LONG_NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
| DECIMAL_NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
| FLOAT_NUM
{
Lex->json_table->m_text_literal_cs= NULL;
}
;
join_table_list:
join_table_list:
derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); }
derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); }
;
;
...
@@ -11684,7 +11705,7 @@ json_on_response:
...
@@ -11684,7 +11705,7 @@ json_on_response:
{
{
$$.m_response= Json_table_column::RESPONSE_NULL;
$$.m_response= Json_table_column::RESPONSE_NULL;
}
}
| DEFAULT json_text_literal
| DEFAULT json_text_literal
_or_num
{
{
$$.m_response= Json_table_column::RESPONSE_DEFAULT;
$$.m_response= Json_table_column::RESPONSE_DEFAULT;
$$.m_default= $2;
$$.m_default= $2;
...
...
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