Commit 9214d043 authored by Sergei Golubchik's avatar Sergei Golubchik

disable SHOW I_S_table for built-in I_S tables

This fixes
MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
parent 57905d18
show statistics;
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 'statistics' at line 1
show spatial_ref_sys
--error ER_PARSE_ERROR
show system_variables;
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 'spatial_ref_sys
--error ER_PARSE_ERROR
show system_variables' at line 2
show geometry_columns;
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 'geometry_columns' at line 1
show nonexistent;
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 'nonexistent' at line 1
#
# MDEV-9538 Server crashes in check_show_access on SHOW STATISTICS
# MDEV-9539 Server crashes in make_columns_old_format on SHOW GEOMETRY_COLUMNS
# MDEV-9540 SHOW SPATIAL_REF_SYS and SHOW SYSTEM_VARIABLES return empty results with numerous warnings
#
--error ER_PARSE_ERROR
show statistics;
--error ER_PARSE_ERROR
show spatial_ref_sys
--error ER_PARSE_ERROR
show system_variables;
--error ER_PARSE_ERROR
show geometry_columns;
--error ER_PARSE_ERROR
show nonexistent;
...@@ -7374,12 +7374,14 @@ static my_bool find_schema_table_in_plugin(THD *thd, plugin_ref plugin, ...@@ -7374,12 +7374,14 @@ static my_bool find_schema_table_in_plugin(THD *thd, plugin_ref plugin,
# pointer to 'schema_tables' element # pointer to 'schema_tables' element
*/ */
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name) ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name,
bool *in_plugin)
{ {
schema_table_ref schema_table_a; schema_table_ref schema_table_a;
ST_SCHEMA_TABLE *schema_table= schema_tables; ST_SCHEMA_TABLE *schema_table= schema_tables;
DBUG_ENTER("find_schema_table"); DBUG_ENTER("find_schema_table");
*in_plugin= false;
for (; schema_table->table_name; schema_table++) for (; schema_table->table_name; schema_table++)
{ {
if (!my_strcasecmp(system_charset_info, if (!my_strcasecmp(system_charset_info,
...@@ -7388,6 +7390,7 @@ ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name) ...@@ -7388,6 +7390,7 @@ ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name)
DBUG_RETURN(schema_table); DBUG_RETURN(schema_table);
} }
*in_plugin= true;
schema_table_a.table_name= table_name; schema_table_a.table_name= table_name;
if (plugin_foreach(thd, find_schema_table_in_plugin, if (plugin_foreach(thd, find_schema_table_in_plugin,
MYSQL_INFORMATION_SCHEMA_PLUGIN, &schema_table_a)) MYSQL_INFORMATION_SCHEMA_PLUGIN, &schema_table_a))
......
...@@ -117,7 +117,10 @@ bool schema_table_store_record(THD *thd, TABLE *table); ...@@ -117,7 +117,10 @@ bool schema_table_store_record(THD *thd, TABLE *table);
void initialize_information_schema_acl(); void initialize_information_schema_acl();
COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table); COND *make_cond_for_info_schema(THD *thd, COND *cond, TABLE_LIST *table);
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name); ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name, bool *in_plugin);
static inline ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name)
{ bool unused; return find_schema_table(thd, table_name, &unused); }
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx); ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
int make_schema_select(THD *thd, SELECT_LEX *sel, int make_schema_select(THD *thd, SELECT_LEX *sel,
ST_SCHEMA_TABLE *schema_table); ST_SCHEMA_TABLE *schema_table);
......
...@@ -12865,9 +12865,10 @@ show_param: ...@@ -12865,9 +12865,10 @@ show_param:
| IDENT_sys remember_tok_start wild_and_where | IDENT_sys remember_tok_start wild_and_where
{ {
LEX *lex= Lex; LEX *lex= Lex;
bool in_plugin;
lex->sql_command= SQLCOM_SHOW_GENERIC; lex->sql_command= SQLCOM_SHOW_GENERIC;
ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str); ST_SCHEMA_TABLE *table= find_schema_table(thd, $1.str, &in_plugin);
if (!table || !table->old_format) if (!table || !table->old_format || !in_plugin)
{ {
my_parse_error(thd, ER_SYNTAX_ERROR, $2); my_parse_error(thd, ER_SYNTAX_ERROR, $2);
MYSQL_YYABORT; MYSQL_YYABORT;
......
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