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
1b81e237
Commit
1b81e237
authored
Apr 12, 2021
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17339 JSON_TABLE.
add_table_to_list - remove the table_function argument.
parent
90629aa8
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
23 deletions
+20
-23
sql/repl_failsafe.cc
sql/repl_failsafe.cc
+1
-1
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/sp_head.cc
sql/sp_head.cc
+1
-1
sql/sql_lex.h
sql/sql_lex.h
+1
-2
sql/sql_parse.cc
sql/sql_parse.cc
+9
-12
sql/sql_parse.h
sql/sql_parse.h
+1
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+4
-3
sql/table.cc
sql/table.cc
+1
-1
No files found.
sql/repl_failsafe.cc
View file @
1b81e237
...
@@ -122,7 +122,7 @@ int THD::register_slave(uchar *packet, size_t packet_length)
...
@@ -122,7 +122,7 @@ int THD::register_slave(uchar *packet, size_t packet_length)
uchar
*
p
=
packet
,
*
p_end
=
packet
+
packet_length
;
uchar
*
p
=
packet
,
*
p_end
=
packet
+
packet_length
;
const
char
*
errmsg
=
"Wrong parameters to function register_slave"
;
const
char
*
errmsg
=
"Wrong parameters to function register_slave"
;
if
(
check_access
(
this
,
PRIV_COM_REGISTER_SLAVE
,
any_db
,
NULL
,
NULL
,
0
,
0
))
if
(
check_access
(
this
,
PRIV_COM_REGISTER_SLAVE
,
any_db
.
str
,
NULL
,
NULL
,
0
,
0
))
return
1
;
return
1
;
if
(
!
(
si
=
(
Slave_info
*
)
my_malloc
(
key_memory_SLAVE_INFO
,
sizeof
(
Slave_info
),
if
(
!
(
si
=
(
Slave_info
*
)
my_malloc
(
key_memory_SLAVE_INFO
,
sizeof
(
Slave_info
),
MYF
(
MY_WME
))))
MYF
(
MY_WME
))))
...
...
sql/set_var.cc
View file @
1b81e237
...
@@ -1089,7 +1089,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -1089,7 +1089,7 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
StringBuffer
<
STRING_BUFFER_USUAL_SIZE
>
strbuf
(
scs
);
StringBuffer
<
STRING_BUFFER_USUAL_SIZE
>
strbuf
(
scs
);
const
char
*
wild
=
thd
->
lex
->
wild
?
thd
->
lex
->
wild
->
ptr
()
:
0
;
const
char
*
wild
=
thd
->
lex
->
wild
?
thd
->
lex
->
wild
->
ptr
()
:
0
;
Field
**
fields
=
tables
->
table
->
field
;
Field
**
fields
=
tables
->
table
->
field
;
bool
has_file_acl
=
!
check_access
(
thd
,
FILE_ACL
,
any_db
,
NULL
,
NULL
,
0
,
1
);
bool
has_file_acl
=
!
check_access
(
thd
,
FILE_ACL
,
any_db
.
str
,
NULL
,
NULL
,
0
,
1
);
DBUG_ASSERT
(
tables
->
table
->
in_use
==
thd
);
DBUG_ASSERT
(
tables
->
table
->
in_use
==
thd
);
...
...
sql/sp_head.cc
View file @
1b81e237
...
@@ -4948,7 +4948,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
...
@@ -4948,7 +4948,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
}
}
for
(;
table
;
table
=
table
->
next_global
)
for
(;
table
;
table
=
table
->
next_global
)
if
(
!
table
->
derived
&&
!
table
->
schema_table
)
if
(
!
table
->
derived
&&
!
table
->
schema_table
&&
!
table
->
table_function
)
{
{
/*
/*
Structure of key for the multi-set is "db\0table\0alias\0".
Structure of key for the multi-set is "db\0table\0alias\0".
...
...
sql/sql_lex.h
View file @
1b81e237
...
@@ -1407,8 +1407,7 @@ class st_select_lex: public st_select_lex_node
...
@@ -1407,8 +1407,7 @@ class st_select_lex: public st_select_lex_node
enum_mdl_type
mdl_type
=
MDL_SHARED_READ
,
enum_mdl_type
mdl_type
=
MDL_SHARED_READ
,
List
<
Index_hint
>
*
hints
=
0
,
List
<
Index_hint
>
*
hints
=
0
,
List
<
String
>
*
partition_names
=
0
,
List
<
String
>
*
partition_names
=
0
,
LEX_STRING
*
option
=
0
,
LEX_STRING
*
option
=
0
);
Table_function_json_table
*
tfunc
=
0
);
TABLE_LIST
*
get_table_list
();
TABLE_LIST
*
get_table_list
();
bool
init_nested_join
(
THD
*
thd
);
bool
init_nested_join
(
THD
*
thd
);
TABLE_LIST
*
end_nested_join
(
THD
*
thd
);
TABLE_LIST
*
end_nested_join
(
THD
*
thd
);
...
...
sql/sql_parse.cc
View file @
1b81e237
...
@@ -132,7 +132,7 @@ static int show_create_db(THD *thd, LEX *lex);
...
@@ -132,7 +132,7 @@ static int show_create_db(THD *thd, LEX *lex);
static
bool
alter_routine
(
THD
*
thd
,
LEX
*
lex
);
static
bool
alter_routine
(
THD
*
thd
,
LEX
*
lex
);
static
bool
drop_routine
(
THD
*
thd
,
LEX
*
lex
);
static
bool
drop_routine
(
THD
*
thd
,
LEX
*
lex
);
const
char
*
any_db
=
"*any*"
;
// Special symbol for check_access
const
LEX_CSTRING
any_db
=
{
"*any*"
,
0
};
const
LEX_CSTRING
command_name
[
257
]
=
{
const
LEX_CSTRING
command_name
[
257
]
=
{
{
STRING_WITH_LEN
(
"Sleep"
)
},
//0
{
STRING_WITH_LEN
(
"Sleep"
)
},
//0
...
@@ -3934,7 +3934,7 @@ mysql_execute_command(THD *thd)
...
@@ -3934,7 +3934,7 @@ mysql_execute_command(THD *thd)
privileges_requested
,
privileges_requested
,
all_tables
,
FALSE
,
UINT_MAX
,
FALSE
);
all_tables
,
FALSE
,
UINT_MAX
,
FALSE
);
else
else
res
=
check_access
(
thd
,
privileges_requested
,
any_db
,
NULL
,
NULL
,
0
,
0
);
res
=
check_access
(
thd
,
privileges_requested
,
any_db
.
str
,
NULL
,
NULL
,
0
,
0
);
if
(
!
res
)
if
(
!
res
)
res
=
execute_sqlcom_select
(
thd
,
all_tables
);
res
=
execute_sqlcom_select
(
thd
,
all_tables
);
...
@@ -4979,7 +4979,7 @@ mysql_execute_command(THD *thd)
...
@@ -4979,7 +4979,7 @@ mysql_execute_command(THD *thd)
goto
error
;
goto
error
;
#else
#else
{
{
if
(
check_access
(
thd
,
FILE_ACL
,
any_db
,
NULL
,
NULL
,
0
,
0
))
if
(
check_access
(
thd
,
FILE_ACL
,
any_db
.
str
,
NULL
,
NULL
,
0
,
0
))
goto
error
;
goto
error
;
res
=
ha_show_status
(
thd
,
lex
->
create_info
.
db_type
,
HA_ENGINE_LOGS
);
res
=
ha_show_status
(
thd
,
lex
->
create_info
.
db_type
,
HA_ENGINE_LOGS
);
break
;
break
;
...
@@ -6694,7 +6694,7 @@ check_access(THD *thd, privilege_t want_access,
...
@@ -6694,7 +6694,7 @@ check_access(THD *thd, privilege_t want_access,
DBUG_RETURN
(
FALSE
);
// CTE reference or an error later
DBUG_RETURN
(
FALSE
);
// CTE reference or an error later
}
}
if
(
likely
((
db
!=
NULL
)
&&
(
db
!=
any_db
)))
if
(
likely
((
db
!=
NULL
)
&&
(
db
!=
any_db
.
str
)))
{
{
/*
/*
Check if this is reserved database, like information schema or
Check if this is reserved database, like information schema or
...
@@ -6781,7 +6781,7 @@ check_access(THD *thd, privilege_t want_access,
...
@@ -6781,7 +6781,7 @@ check_access(THD *thd, privilege_t want_access,
DBUG_RETURN
(
TRUE
);
/* purecov: tested */
DBUG_RETURN
(
TRUE
);
/* purecov: tested */
}
}
if
(
unlikely
(
db
==
any_db
))
if
(
unlikely
(
db
==
any_db
.
str
))
{
{
/*
/*
Access granted; Allow select on *any* db.
Access granted; Allow select on *any* db.
...
@@ -7114,8 +7114,7 @@ check_table_access(THD *thd, privilege_t requirements, TABLE_LIST *tables,
...
@@ -7114,8 +7114,7 @@ check_table_access(THD *thd, privilege_t requirements, TABLE_LIST *tables,
}
}
if
(
check_access
(
thd
,
want_access
,
if
(
check_access
(
thd
,
want_access
,
table_ref
->
table_function
?
any_db
:
table_ref
->
get_db_name
(),
table_ref
->
get_db_name
(),
&
table_ref
->
grant
.
privilege
,
&
table_ref
->
grant
.
privilege
,
&
table_ref
->
grant
.
m_internal
,
&
table_ref
->
grant
.
m_internal
,
0
,
no_errors
))
0
,
no_errors
))
...
@@ -8161,8 +8160,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
...
@@ -8161,8 +8160,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
enum_mdl_type
mdl_type
,
enum_mdl_type
mdl_type
,
List
<
Index_hint
>
*
index_hints_arg
,
List
<
Index_hint
>
*
index_hints_arg
,
List
<
String
>
*
partition_names
,
List
<
String
>
*
partition_names
,
LEX_STRING
*
option
,
LEX_STRING
*
option
)
Table_function_json_table
*
tfunc
)
{
{
TABLE_LIST
*
ptr
;
TABLE_LIST
*
ptr
;
TABLE_LIST
*
UNINIT_VAR
(
previous_table_ref
);
/* The table preceding the current one. */
TABLE_LIST
*
UNINIT_VAR
(
previous_table_ref
);
/* The table preceding the current one. */
...
@@ -8225,13 +8223,12 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
...
@@ -8225,13 +8223,12 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
if
(
table
->
table
.
length
)
if
(
table
->
table
.
length
)
table
->
table
.
length
=
my_casedn_str
(
files_charset_info
,
table
->
table
.
length
=
my_casedn_str
(
files_charset_info
,
(
char
*
)
table
->
table
.
str
);
(
char
*
)
table
->
table
.
str
);
if
(
ptr
->
db
.
length
&&
ptr
->
db
.
str
!=
any_db
)
if
(
ptr
->
db
.
length
&&
ptr
->
db
.
str
!=
any_db
.
str
)
ptr
->
db
.
length
=
my_casedn_str
(
files_charset_info
,
(
char
*
)
ptr
->
db
.
str
);
ptr
->
db
.
length
=
my_casedn_str
(
files_charset_info
,
(
char
*
)
ptr
->
db
.
str
);
}
}
ptr
->
table_name
=
table
->
table
;
ptr
->
table_name
=
table
->
table
;
ptr
->
lock_type
=
lock_type
;
ptr
->
lock_type
=
lock_type
;
ptr
->
table_function
=
tfunc
;
ptr
->
updating
=
MY_TEST
(
table_options
&
TL_OPTION_UPDATING
);
ptr
->
updating
=
MY_TEST
(
table_options
&
TL_OPTION_UPDATING
);
/* TODO: remove TL_OPTION_FORCE_INDEX as it looks like it's not used */
/* TODO: remove TL_OPTION_FORCE_INDEX as it looks like it's not used */
ptr
->
force_index
=
MY_TEST
(
table_options
&
TL_OPTION_FORCE_INDEX
);
ptr
->
force_index
=
MY_TEST
(
table_options
&
TL_OPTION_FORCE_INDEX
);
...
@@ -8276,7 +8273,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
...
@@ -8276,7 +8273,7 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
{
{
if
(
unlikely
(
!
my_strcasecmp
(
table_alias_charset
,
alias_str
.
str
,
if
(
unlikely
(
!
my_strcasecmp
(
table_alias_charset
,
alias_str
.
str
,
tables
->
alias
.
str
)
&&
tables
->
alias
.
str
)
&&
(
tables
->
table_function
||
ptr
->
table_function
||
(
tables
->
db
.
str
==
any_db
.
str
||
ptr
->
db
.
str
==
any_db
.
str
||
!
cmp
(
&
ptr
->
db
,
&
tables
->
db
))
&&
!
cmp
(
&
ptr
->
db
,
&
tables
->
db
))
&&
!
tables
->
sequence
))
!
tables
->
sequence
))
{
{
...
...
sql/sql_parse.h
View file @
1b81e237
...
@@ -131,7 +131,7 @@ bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
...
@@ -131,7 +131,7 @@ bool check_stack_overrun(THD *thd, long margin, uchar *dummy);
/* Variables */
/* Variables */
extern
const
char
*
any_db
;
extern
const
LEX_CSTRING
any_db
;
extern
uint
sql_command_flags
[];
extern
uint
sql_command_flags
[];
extern
uint
server_command_flags
[];
extern
uint
server_command_flags
[];
extern
const
LEX_CSTRING
command_name
[];
extern
const
LEX_CSTRING
command_name
[];
...
...
sql/sql_prepare.cc
View file @
1b81e237
...
@@ -1545,7 +1545,7 @@ static int mysql_test_select(Prepared_statement *stmt,
...
@@ -1545,7 +1545,7 @@ static int mysql_test_select(Prepared_statement *stmt,
if
(
check_table_access
(
thd
,
privilege
,
tables
,
FALSE
,
UINT_MAX
,
FALSE
))
if
(
check_table_access
(
thd
,
privilege
,
tables
,
FALSE
,
UINT_MAX
,
FALSE
))
goto
error
;
goto
error
;
}
}
else
if
(
check_access
(
thd
,
privilege
,
any_db
,
NULL
,
NULL
,
0
,
0
))
else
if
(
check_access
(
thd
,
privilege
,
any_db
.
str
,
NULL
,
NULL
,
0
,
0
))
goto
error
;
goto
error
;
if
(
!
lex
->
result
&&
!
(
lex
->
result
=
new
(
stmt
->
mem_root
)
select_send
(
thd
)))
if
(
!
lex
->
result
&&
!
(
lex
->
result
=
new
(
stmt
->
mem_root
)
select_send
(
thd
)))
...
...
sql/sql_yacc.yy
View file @
1b81e237
...
@@ -11713,15 +11713,16 @@ table_function:
...
@@ -11713,15 +11713,16 @@ table_function:
MYSQL_YYABORT;
MYSQL_YYABORT;
sel->table_join_options= 0;
sel->table_join_options= 0;
if (!($$= Select->add_table_to_list(thd,
if (!($$= Select->add_table_to_list(thd,
new (thd->mem_root) Table_ident(thd, &
empty_clex_str
,
new (thd->mem_root) Table_ident(thd, &
any_db
,
$10, TRUE),
$10, TRUE),
NULL,
NULL,
Select->get_table_join_options() |
Select->get_table_join_options() |
TL_OPTION_TABLE_FUNCTION,
TL_OPTION_TABLE_FUNCTION,
YYPS->m_lock_type,
YYPS->m_lock_type,
YYPS->m_mdl_type,
YYPS->m_mdl_type,
0,0,0
, Lex->json_table
)))
0,0,0)))
MYSQL_YYABORT;
MYSQL_YYABORT;
$$->table_function= Lex->json_table;
Lex->json_table= 0;
Lex->json_table= 0;
status_var_increment(thd->status_var.feature_json);
status_var_increment(thd->status_var.feature_json);
}
}
...
@@ -15376,7 +15377,7 @@ table_ident_opt_wild:
...
@@ -15376,7 +15377,7 @@ table_ident_opt_wild:
table_ident_nodb:
table_ident_nodb:
ident
ident
{
{
LEX_CSTRING db=
{(char*) any_db,3}
;
LEX_CSTRING db=
any_db
;
$$= new (thd->mem_root) Table_ident(thd, &db, &$1, 0);
$$= new (thd->mem_root) Table_ident(thd, &db, &$1, 0);
if (unlikely($$ == NULL))
if (unlikely($$ == NULL))
MYSQL_YYABORT;
MYSQL_YYABORT;
...
...
sql/table.cc
View file @
1b81e237
...
@@ -4951,7 +4951,7 @@ bool check_db_name(LEX_STRING *org_name)
...
@@ -4951,7 +4951,7 @@ bool check_db_name(LEX_STRING *org_name)
if
(
!
name_length
||
name_length
>
NAME_LEN
)
if
(
!
name_length
||
name_length
>
NAME_LEN
)
return
1
;
return
1
;
if
(
lower_case_table_names
==
1
&&
name
!=
any_db
)
if
(
lower_case_table_names
==
1
&&
name
!=
any_db
.
str
)
{
{
org_name
->
length
=
name_length
=
my_casedn_str
(
files_charset_info
,
name
);
org_name
->
length
=
name_length
=
my_casedn_str
(
files_charset_info
,
name
);
if
(
check_for_path_chars
)
if
(
check_for_path_chars
)
...
...
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