| 8104 | */ |
| 8105 | |
| 8106 | TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, |
| 8107 | Table_ident *table, |
| 8108 | const LEX_CSTRING *alias, |
| 8109 | ulong table_options, |
| 8110 | thr_lock_type lock_type, |
| 8111 | enum_mdl_type mdl_type, |
| 8112 | List<Index_hint> *index_hints_arg, |
| 8113 | List<String> *partition_names, |
| 8114 | LEX_STRING *option) |
| 8115 | { |
| 8116 | DBUG_ENTER("add_table_to_list"); |
| 8117 | DBUG_PRINT("enter", ("Table '%s' (%p) Select %p (%u)", |
| 8118 | (alias ? alias->str : table->table.str), |
| 8119 | table, |
| 8120 | this, select_number)); |
| 8121 | DBUG_ASSERT(!is_service_select || (table_options & TL_OPTION_SEQUENCE)); |
| 8122 | |
| 8123 | if (unlikely(!table)) |
| 8124 | DBUG_RETURN(0); // End of memory |
| 8125 | if (!(table_options & TL_OPTION_ALIAS) && |
| 8126 | unlikely(Lex_ident_table::check_name(table->table, FALSE))) |
| 8127 | { |
| 8128 | my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str); |
| 8129 | DBUG_RETURN(0); |
| 8130 | } |
| 8131 | |
| 8132 | if (unlikely(table->is_derived_table() == FALSE && table->db.str && |
| 8133 | !(table_options & TL_OPTION_TABLE_FUNCTION) && |
| 8134 | Lex_ident_db::check_name_with_error(table->db))) |
| 8135 | DBUG_RETURN(0); |
| 8136 | |
| 8137 | Lex_ident_db db{0, 0}; |
| 8138 | bool fqtn= false; |
| 8139 | LEX *lex= thd->lex; |
| 8140 | if (table->db.str) |
| 8141 | { |
| 8142 | fqtn= TRUE; |
| 8143 | db= Lex_ident_db(table->db); |
| 8144 | } |
| 8145 | else if (!lex->with_cte_resolution && lex->copy_db_to(&db)) |
| 8146 | DBUG_RETURN(0); |
| 8147 | else |
| 8148 | fqtn= FALSE; |
| 8149 | bool info_schema= (db.is_null() || db.is_empty()) |
| 8150 | ? false : is_infoschema_db(&db); |
| 8151 | if (!table->sel && info_schema && |
| 8152 | (table_options & TL_OPTION_UPDATING) && |
| 8153 | /* Special cases which are processed by commands itself */ |
| 8154 | lex->sql_command != SQLCOM_CHECK && |
| 8155 | lex->sql_command != SQLCOM_CHECKSUM) |
| 8156 | { |
| 8157 | my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), |
| 8158 | thd->security_ctx->priv_user, |
| 8159 | thd->security_ctx->priv_host, |
| 8160 | INFORMATION_SCHEMA_NAME.str); |
| 8161 | DBUG_RETURN(0); |
| 8162 | } |
| 8163 |
no test coverage detected