summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2004-12-10 12:07:11 +0300
committerunknown <gluh@gluh.mysql.r18.ru>2004-12-10 12:07:11 +0300
commitc7d7c9ca10b1ee19cb017bfe9bb8b183ef9022a1 (patch)
tree66e74d7dcaa0816cb4ae36f5ba45e910cdaa6267 /sql
parent6f8ca2513e19db9359c46bc8370f3a8b36d3a5d2 (diff)
downloadmariadb-git-c7d7c9ca10b1ee19cb017bfe9bb8b183ef9022a1.tar.gz
Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges
mysqldump skips information_schema db 'use' now can use information_schema db changed value of column 'Null' to 'NO' if column is not nullable client/mysqldump.c: mysqldump skips information_schema db mysql-test/r/alter_table.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/create.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ctype_collate.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ctype_recoding.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ctype_ujis.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/drop.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/func_sapdb.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/func_time.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/gis.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/information_schema.result: Added couple of tests mysql-test/r/information_schema_inno.result: Removed coulmn 'CONTRAINT_METOD' from TABLE_CONSTRAINTS Added column 'POSITION_IN_UNIQUE_CONSTRAINT' to KEY_COLUMN_USAGE mysql-test/r/innodb.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ndb_autodiscover.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/ps_1general.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/rpl000009.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/rpl_create_database.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/schema.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/select.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/show_check.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/sp.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/type_enum.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/r/type_ranges.result: changed value of column 'Null' to 'NO' if column is not nullable mysql-test/t/information_schema.test: Added couple of tests sql/sql_acl.cc: Don't display 'usage' privilege in TABLE_PRIVILEGES if we have columns privileges sql/sql_db.cc: 'use' now can use information_schema db sql/sql_show.cc: code cleanup informaton_schema(IS) db now contains data about IS itself sql/sql_yacc.yy: A fix(wrong behavour of 'SHOW COLUMNS, SHOW KEYS' with 'where condition')
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_db.cc38
-rw-r--r--sql/sql_show.cc231
-rw-r--r--sql/sql_yacc.yy23
4 files changed, 206 insertions, 90 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 8be915b89e2..b0e4672c570 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -4670,9 +4670,11 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(user=grant_table->user))
user= "";
ulong table_access= grant_table->privs;
- if (table_access != 0)
+ if (table_access)
{
ulong test_access= table_access & ~GRANT_ACL;
+ if (!test_access && grant_table->cols)
+ continue;
if (!(table_access & GRANT_ACL))
is_grantable= "NO";
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 3e606029bec..ea81013a401 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -389,6 +389,13 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
uint create_options= create_info ? create_info->options : 0;
uint path_len;
DBUG_ENTER("mysql_create_db");
+
+ /* do not create 'information_schema' db */
+ if (!my_strcasecmp(system_charset_info, db, information_schema_name.str))
+ {
+ my_error(ER_DB_CREATE_EXISTS, MYF(0), db);
+ DBUG_RETURN(-1);
+ }
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
@@ -1015,6 +1022,7 @@ bool mysql_change_db(THD *thd, const char *name)
char *dbname=my_strdup((char*) name,MYF(MY_WME));
char path[FN_REFLEN];
HA_CREATE_INFO create;
+ bool schema_db= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
ulong db_access;
#endif
@@ -1034,6 +1042,15 @@ bool mysql_change_db(THD *thd, const char *name)
DBUG_RETURN(1);
}
DBUG_PRINT("info",("Use database: %s", dbname));
+ if (!my_strcasecmp(system_charset_info, dbname, information_schema_name.str))
+ {
+ schema_db= 1;
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ db_access= SELECT_ACL;
+#endif
+ goto end;
+ }
+
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (test_all_bits(thd->master_access,DB_ACLS))
db_access=DB_ACLS;
@@ -1064,6 +1081,7 @@ bool mysql_change_db(THD *thd, const char *name)
my_free(dbname,MYF(0));
DBUG_RETURN(1);
}
+end:
send_ok(thd);
x_free(thd->db);
thd->db=dbname; // THD::~THD will free this
@@ -1071,11 +1089,19 @@ bool mysql_change_db(THD *thd, const char *name)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
thd->db_access=db_access;
#endif
- strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
- load_db_opt(thd, path, &create);
- thd->db_charset= create.default_table_charset ?
- create.default_table_charset :
- thd->variables.collation_server;
- thd->variables.collation_database= thd->db_charset;
+ if (schema_db)
+ {
+ thd->db_charset= system_charset_info;
+ thd->variables.collation_database= system_charset_info;
+ }
+ else
+ {
+ strmov(path+unpack_dirname(path,path), MY_DB_OPT_FILE);
+ load_db_opt(thd, path, &create);
+ thd->db_charset= create.default_table_charset ?
+ create.default_table_charset :
+ thd->variables.collation_server;
+ thd->variables.collation_database= thd->db_charset;
+ }
DBUG_RETURN(0);
}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 7acbe564f58..0095d38ad94 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1941,6 +1941,40 @@ static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
}
+int schema_db_add(THD *thd, List<char> *files, const char *wild)
+{
+ if (wild && wild_compare(information_schema_name.str, wild, 0))
+ return 0;
+ if (files->push_back(thd->strdup(information_schema_name.str)))
+ return -1;
+ return 1;
+}
+
+
+int schema_tables_add(THD *thd, List<char> *files, const char *wild)
+{
+ ST_SCHEMA_TABLE *tmp_schema_table= schema_tables;
+ for ( ; tmp_schema_table->table_name; tmp_schema_table++)
+ {
+ if (wild)
+ {
+ if (lower_case_table_names)
+ {
+ if (wild_case_compare(files_charset_info,
+ tmp_schema_table->table_name,
+ wild))
+ continue;
+ }
+ else if (wild_compare(tmp_schema_table->table_name, wild, 0))
+ continue;
+ }
+ if (files->push_back(thd->strdup(tmp_schema_table->table_name)))
+ return 1;
+ }
+ return 0;
+}
+
+
int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{
LEX *lex= thd->lex;
@@ -1970,8 +2004,9 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals;
- char path[FN_REFLEN], *end, *base_name, *file_name;
- uint len;
+ char path[FN_REFLEN], *end= 0, *base_name, *file_name;
+ uint len= 0;
+ int with_i_schema;
List<char> bases;
lex->all_selects_list= &sel;
enum enum_schema_tables schema_table_idx=
@@ -1980,6 +2015,12 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (schema_table_idx == SCH_TABLES)
lock_type= TL_READ;
get_index_field_values(lex, &idx_field_vals);
+
+ /* information schema name always is first in list */
+ with_i_schema= schema_db_add(thd, &bases, idx_field_vals.db_value);
+ if (with_i_schema < 0)
+ return 1;
+
if (mysql_find_files(thd, &bases, NullS, mysql_data_home,
idx_field_vals.db_value, 1))
return 1;
@@ -1995,19 +2036,28 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
(base_name= select_lex->db) && !bases.elements))
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (!check_access(thd,SELECT_ACL, base_name, &thd->col_access,0,1) ||
+ if (with_i_schema || // don't check the rights if information schema db
+ !check_access(thd,SELECT_ACL, base_name, &thd->col_access,0,1) ||
thd->master_access & (DB_ACLS | SHOW_DB_ACL) ||
acl_get(thd->host, thd->ip, thd->priv_user, base_name,0) ||
(grant_option && !check_grant_db(thd, base_name)))
#endif
{
List<char> files;
- strxmov(path, mysql_data_home, "/", base_name, NullS);
- end= path + (len= unpack_dirname(path,path));
- len= FN_LEN - len;
- if (mysql_find_files(thd, &files, base_name,
- path, idx_field_vals.table_value, 0))
- DBUG_RETURN(1);
+ if (with_i_schema) // information schema table names
+ {
+ if (schema_tables_add(thd, &files, idx_field_vals.table_value))
+ DBUG_RETURN(1);
+ }
+ else
+ {
+ strxmov(path, mysql_data_home, "/", base_name, NullS);
+ end= path + (len= unpack_dirname(path,path));
+ len= FN_LEN - len;
+ if (mysql_find_files(thd, &files, base_name,
+ path, idx_field_vals.table_value, 0))
+ DBUG_RETURN(1);
+ }
List_iterator_fast<char> it(files);
while ((file_name=it++))
@@ -2023,20 +2073,27 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{
if (lex->verbose || lex->orig_sql_command == SQLCOM_END)
{
- my_snprintf(end, len, "/%s%s", file_name, reg_ext);
- switch (mysql_frm_type(path))
+ if (with_i_schema)
{
- case FRMTYPE_ERROR:
- table->field[3]->store("ERROR", 5, system_charset_info);
- break;
- case FRMTYPE_TABLE:
- table->field[3]->store("BASE TABLE", 10, system_charset_info);
- break;
- case FRMTYPE_VIEW:
- table->field[3]->store("VIEW", 4, system_charset_info);
- break;
- default:
- DBUG_ASSERT(0);
+ table->field[3]->store("TEMPORARY", 9, system_charset_info);
+ }
+ else
+ {
+ my_snprintf(end, len, "/%s%s", file_name, reg_ext);
+ switch (mysql_frm_type(path))
+ {
+ case FRMTYPE_ERROR:
+ table->field[3]->store("ERROR", 5, system_charset_info);
+ break;
+ case FRMTYPE_TABLE:
+ table->field[3]->store("BASE TABLE", 10, system_charset_info);
+ break;
+ case FRMTYPE_VIEW:
+ table->field[3]->store("VIEW", 4, system_charset_info);
+ break;
+ default:
+ DBUG_ASSERT(0);
+ }
}
}
table->file->write_row(table->record[0]);
@@ -2059,6 +2116,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
}
}
+ with_i_schema= 0;
}
}
lex->all_selects_list= select_lex;
@@ -2066,6 +2124,16 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
}
+void store_schema_shemata(TABLE *table, const char *db_name,
+ const char* cs_name)
+{
+ restore_record(table, default_values);
+ table->field[1]->store(db_name, strlen(db_name), system_charset_info);
+ table->field[2]->store(cs_name, strlen(cs_name), system_charset_info);
+ table->file->write_row(table->record[0]);
+}
+
+
int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
{
char path[FN_REFLEN],*end;
@@ -2074,16 +2142,26 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
List<char> files;
char *file_name;
uint length;
+ int with_i_schema;
HA_CREATE_INFO create;
TABLE *table= tables->table;
get_index_field_values(thd->lex, &idx_field_vals);
+ with_i_schema= schema_db_add(thd, &files, idx_field_vals.db_value);
+ if (with_i_schema < 0)
+ return 1;
if (mysql_find_files(thd, &files, NullS, mysql_data_home,
idx_field_vals.db_value, 1))
return 1;
List_iterator_fast<char> it(files);
while ((file_name=it++))
{
+ if (with_i_schema) // information schema name is always first in list
+ {
+ store_schema_shemata(table, file_name, system_charset_info->csname);
+ with_i_schema= 0;
+ continue;
+ }
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (thd->master_access & (DB_ACLS | SHOW_DB_ACL) ||
acl_get(thd->host, thd->ip, thd->priv_user, file_name,0) ||
@@ -2103,12 +2181,8 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
path[length-1]= FN_LIBCHAR;
strmov(path+length, MY_DB_OPT_FILE);
load_db_opt(thd, path, &create);
- restore_record(table, default_values);
- table->field[1]->store(file_name, strlen(file_name), system_charset_info);
- table->field[2]->store(create.default_table_charset->csname,
- strlen(create.default_table_charset->csname),
- system_charset_info);
- table->file->write_row(table->record[0]);
+ store_schema_shemata(table, file_name,
+ create.default_table_charset->csname);
}
}
return 0;
@@ -2147,7 +2221,11 @@ static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
TABLE *show_table= tables->table;
handler *file= show_table->file;
file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_NO_LOCK);
- table->field[3]->store("BASE TABLE", 10, cs);
+ if (table->tmp_table == TMP_TABLE)
+ table->field[3]->store("TEMPORARY", 9, cs);
+ else
+ table->field[3]->store("BASE TABLE", 10, cs);
+
for (int i= 4; i < 20; i++)
{
if ((i > 12 && i < 17) || i == 18)
@@ -2341,7 +2419,7 @@ static int get_schema_column_record(THD *thd, struct st_table_list *tables,
}
pos=(byte*) ((flags & NOT_NULL_FLAG) &&
field->type() != FIELD_TYPE_TIMESTAMP ?
- "" : "YES");
+ "NO" : "YES");
table->field[6]->store((const char*) pos,
strlen((const char*) pos), cs);
if (field->has_charset())
@@ -2741,12 +2819,26 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
}
+void store_constarints(TABLE *table, const char*db, const char *tname,
+ const char *key_name, uint key_len,
+ const char *con_type, uint con_len)
+{
+ CHARSET_INFO *cs= system_charset_info;
+ restore_record(table, default_values);
+ table->field[1]->store(db, strlen(db), cs);
+ table->field[2]->store(key_name, key_len, cs);
+ table->field[3]->store(db, strlen(db), cs);
+ table->field[4]->store(tname, strlen(tname), cs);
+ table->field[5]->store(con_type, con_len, cs);
+ table->file->write_row(table->record[0]);
+}
+
+
static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
const char *base_name,
const char *file_name)
{
- CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_constarints_record");
if (!res && !tables->view)
{
@@ -2760,17 +2852,14 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
for (uint i=0 ; i < show_table->keys ; i++, key_info++)
{
if (i != primary_key && !(key_info->flags & HA_NOSAME))
- continue;
- restore_record(table, default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(key_info->name, strlen(key_info->name), cs);
- table->field[3]->store(base_name, strlen(base_name), cs);
- table->field[4]->store(file_name, strlen(file_name), cs);
+ continue;
+
if (i == primary_key && !strcmp(key_info->name, primary_key_name))
- table->field[5]->store("PRIMARY KEY", 11, cs);
+ store_constarints(table, base_name, file_name, key_info->name,
+ strlen(key_info->name), "PRIMARY KEY", 11);
else if (key_info->flags & HA_NOSAME)
- table->field[5]->store("UNIQUE", 6, cs);
- table->file->write_row(table->record[0]);
+ store_constarints(table, base_name, file_name, key_info->name,
+ strlen(key_info->name), "UNIQUE", 6);
}
show_table->file->get_foreign_key_list(thd, &f_key_list);
@@ -2778,23 +2867,28 @@ static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
while ((f_key_info=it++))
{
- restore_record(table, default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(f_key_info->forein_id->str,
- f_key_info->forein_id->length, cs);
- table->field[3]->store(base_name, strlen(base_name), cs);
- table->field[4]->store(file_name, strlen(file_name), cs);
- table->field[5]->store("FOREIGN KEY", 11, system_charset_info);
- table->field[6]->store(f_key_info->constraint_method->str,
- f_key_info->constraint_method->length, cs);
- table->field[6]->set_notnull();
- table->file->write_row(table->record[0]);
+ store_constarints(table, base_name, file_name, f_key_info->forein_id->str,
+ strlen(f_key_info->forein_id->str), "FOREIGN KEY", 11);
}
}
DBUG_RETURN(res);
}
+void store_key_column_usage(TABLE *table, const char*db, const char *tname,
+ const char *key_name, uint key_len,
+ const char *con_type, uint con_len, longlong idx)
+{
+ CHARSET_INFO *cs= system_charset_info;
+ table->field[1]->store(db, strlen(db), cs);
+ table->field[2]->store(key_name, key_len, cs);
+ table->field[4]->store(db, strlen(db), cs);
+ table->field[5]->store(tname, strlen(tname), cs);
+ table->field[6]->store(con_type, con_len, cs);
+ table->field[7]->store((longlong) idx);
+}
+
+
static int get_schema_key_column_usage_record(THD *thd,
struct st_table_list *tables,
TABLE *table, bool res,
@@ -2825,13 +2919,12 @@ static int get_schema_key_column_usage_record(THD *thd,
{
f_idx++;
restore_record(table, default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(key_info->name, strlen(key_info->name), cs);
- table->field[4]->store(base_name, strlen(base_name), cs);
- table->field[5]->store(file_name, strlen(file_name), cs);
- table->field[6]->store(key_part->field->field_name,
- strlen(key_part->field->field_name), cs);
- table->field[7]->store((longlong) f_idx);
+ store_key_column_usage(table, base_name, file_name,
+ key_info->name,
+ strlen(key_info->name),
+ key_part->field->field_name,
+ strlen(key_part->field->field_name),
+ (longlong) f_idx);
table->file->write_row(table->record[0]);
}
}
@@ -2851,21 +2944,21 @@ static int get_schema_key_column_usage_record(THD *thd,
r_info= it1++;
f_idx++;
restore_record(table, default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(f_key_info->forein_id->str,
- f_key_info->forein_id->length, cs);
- table->field[4]->store(base_name, strlen(base_name), cs);
- table->field[5]->store(file_name, strlen(file_name), cs);
- table->field[6]->store(f_info->str, f_info->length, cs);
- table->field[7]->store((longlong) f_idx);
- table->field[8]->store(f_key_info->referenced_db->str,
+ store_key_column_usage(table, base_name, file_name,
+ f_key_info->forein_id->str,
+ f_key_info->forein_id->length,
+ f_info->str, f_info->length,
+ (longlong) f_idx);
+ table->field[8]->store((longlong) f_idx);
+ table->field[8]->set_notnull();
+ table->field[9]->store(f_key_info->referenced_db->str,
f_key_info->referenced_db->length, cs);
table->field[9]->set_notnull();
table->field[10]->store(f_key_info->referenced_table->str,
f_key_info->referenced_table->length, cs);
- table->field[9]->set_notnull();
- table->field[10]->store(r_info->str, r_info->length, cs);
table->field[10]->set_notnull();
+ table->field[11]->store(r_info->str, r_info->length, cs);
+ table->field[11]->set_notnull();
table->file->write_row(table->record[0]);
}
}
@@ -3466,7 +3559,6 @@ ST_FIELD_INFO table_constraints_fields_info[]=
{"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"CONSTRAINT_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CONSTRAINT_METHOD", 20, MYSQL_TYPE_STRING, 0, 1, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
@@ -3481,6 +3573,7 @@ ST_FIELD_INFO key_column_usage_fields_info[]=
{"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONG, 0, 0, 0},
+ {"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONG, 0, 1, 0},
{"REFERENCED_TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"REFERENCED_COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 8b3cdda5d9e..3511777dd27 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -670,7 +670,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
opt_table_alias
%type <table>
- table_ident table_ident_nodb references from_table_ident
+ table_ident table_ident_nodb references
%type <simple_string>
remember_name remember_end opt_ident opt_db text_or_password
@@ -5902,14 +5902,14 @@ show_param:
| ENGINE_SYM storage_engines
{ Lex->create_info.db_type= $2; }
show_engine_param
- | opt_full COLUMNS ext_select_item_list from_table_ident opt_db wild_and_where
+ | opt_full COLUMNS ext_select_item_list from_or_in table_ident opt_db wild_and_where
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_FIELDS;
- if ($5)
- $4->change_db($5);
- if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
+ if ($6)
+ $5->change_db($6);
+ if (prepare_schema_table(YYTHD, lex, $5, SCH_COLUMNS))
YYABORT;
}
| NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ
@@ -5935,14 +5935,14 @@ show_param:
LEX *lex= Lex;
lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS;
} opt_limit_clause_init
- | keys_or_index ext_select_item_list from_table_ident opt_db where_clause
+ | keys_or_index ext_select_item_list from_or_in table_ident opt_db where_clause
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_KEYS;
- if ($4)
- $3->change_db($4);
- if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS))
+ if ($5)
+ $4->change_db($5);
+ if (prepare_schema_table(YYTHD, lex, $4, SCH_STATISTICS))
YYABORT;
}
| COLUMN_SYM TYPES_SYM
@@ -6159,11 +6159,6 @@ binlog_from:
/* empty */ { Lex->mi.pos = 4; /* skip magic number */ }
| FROM ulonglong_num { Lex->mi.pos = $2; };
-from_table_ident:
- /* empty */ { $$= 0; }
- | from_or_in table_ident { $$= $2; }
- ;
-
wild_and_where:
/* empty */
| LIKE TEXT_STRING_sys