mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-25292 select_create::create_table removed
create_table duplicates select_insert::table_list. Since select_create inherits select_insert and the functional role of the members is the same we should remove one to eliminate the need of keeping them in sync.
This commit is contained in:
@ -4507,7 +4507,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP))
|
||||
promote_first_timestamp_column(&alter_info->create_list);
|
||||
|
||||
if (create_info->fix_create_fields(thd, alter_info, *create_table))
|
||||
if (create_info->fix_create_fields(thd, alter_info, *table_list))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
while ((item=it++))
|
||||
@ -4548,20 +4548,20 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
}
|
||||
|
||||
if (create_info->check_fields(thd, alter_info,
|
||||
create_table->table_name,
|
||||
create_table->db))
|
||||
table_list->table_name,
|
||||
table_list->db))
|
||||
DBUG_RETURN(NULL);
|
||||
|
||||
DEBUG_SYNC(thd,"create_table_select_before_create");
|
||||
|
||||
/* Check if LOCK TABLES + CREATE OR REPLACE of existing normal table*/
|
||||
if (thd->locked_tables_mode && create_table->table &&
|
||||
if (thd->locked_tables_mode && table_list->table &&
|
||||
!create_info->tmp_table())
|
||||
{
|
||||
/* Remember information about the locked table */
|
||||
create_info->pos_in_locked_tables=
|
||||
create_table->table->pos_in_locked_tables;
|
||||
create_info->mdl_ticket= create_table->table->mdl_ticket;
|
||||
table_list->table->pos_in_locked_tables;
|
||||
create_info->mdl_ticket= table_list->table->mdl_ticket;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4582,10 +4582,10 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
*/
|
||||
|
||||
if (!mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm,
|
||||
&create_table->db,
|
||||
&create_table->table_name,
|
||||
&table_list->db,
|
||||
&table_list->table_name,
|
||||
create_info, alter_info, NULL,
|
||||
C_ORDINARY_CREATE, create_table))
|
||||
C_ORDINARY_CREATE, table_list))
|
||||
{
|
||||
DEBUG_SYNC(thd,"create_table_select_before_open");
|
||||
|
||||
@ -4593,7 +4593,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
If we had a temporary table or a table used with LOCK TABLES,
|
||||
it was closed by mysql_create()
|
||||
*/
|
||||
create_table->table= 0;
|
||||
table_list->table= 0;
|
||||
|
||||
if (!create_info->tmp_table())
|
||||
{
|
||||
@ -4601,20 +4601,20 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
TABLE_LIST::enum_open_strategy save_open_strategy;
|
||||
|
||||
/* Force the newly created table to be opened */
|
||||
save_open_strategy= create_table->open_strategy;
|
||||
create_table->open_strategy= TABLE_LIST::OPEN_NORMAL;
|
||||
save_open_strategy= table_list->open_strategy;
|
||||
table_list->open_strategy= TABLE_LIST::OPEN_NORMAL;
|
||||
/*
|
||||
Here we open the destination table, on which we already have
|
||||
an exclusive metadata lock.
|
||||
*/
|
||||
if (open_table(thd, create_table, &ot_ctx))
|
||||
if (open_table(thd, table_list, &ot_ctx))
|
||||
{
|
||||
quick_rm_table(thd, create_info->db_type, &create_table->db,
|
||||
table_case_name(create_info, &create_table->table_name),
|
||||
quick_rm_table(thd, create_info->db_type, &table_list->db,
|
||||
table_case_name(create_info, &table_list->table_name),
|
||||
0);
|
||||
}
|
||||
/* Restore */
|
||||
create_table->open_strategy= save_open_strategy;
|
||||
table_list->open_strategy= save_open_strategy;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4622,8 +4622,8 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
The pointer to the newly created temporary table has been stored in
|
||||
table->create_info.
|
||||
*/
|
||||
create_table->table= create_info->table;
|
||||
if (!create_table->table)
|
||||
table_list->table= create_info->table;
|
||||
if (!table_list->table)
|
||||
{
|
||||
/*
|
||||
This shouldn't happen as creation of temporary table should make
|
||||
@ -4635,9 +4635,9 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
}
|
||||
}
|
||||
else
|
||||
create_table->table= 0; // Create failed
|
||||
table_list->table= 0; // Create failed
|
||||
|
||||
if (unlikely(!(table= create_table->table)))
|
||||
if (unlikely(!(table= table_list->table)))
|
||||
{
|
||||
if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS
|
||||
my_ok(thd); // succeed, but did nothing
|
||||
@ -4679,7 +4679,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
mysql_unlock_tables(thd, *lock);
|
||||
*lock= 0;
|
||||
}
|
||||
drop_open_table(thd, table, &create_table->db, &create_table->table_name);
|
||||
drop_open_table(thd, table, &table_list->db, &table_list->table_name);
|
||||
ddl_log_complete(&ddl_log_state_rm);
|
||||
ddl_log_complete(&ddl_log_state_create);
|
||||
DBUG_RETURN(NULL);
|
||||
@ -4726,10 +4726,10 @@ int select_create::postlock(THD *thd, TABLE **tables)
|
||||
NOTE: for row format CREATE TABLE must be logged before row data.
|
||||
*/
|
||||
int error;
|
||||
TABLE_LIST *save_next_global= create_table->next_global;
|
||||
create_table->next_global= select_tables;
|
||||
error= thd->decide_logging_format(create_table);
|
||||
create_table->next_global= save_next_global;
|
||||
TABLE_LIST *save_next_global= table_list->next_global;
|
||||
table_list->next_global= select_tables;
|
||||
error= thd->decide_logging_format(table_list);
|
||||
table_list->next_global= save_next_global;
|
||||
|
||||
if (unlikely(error))
|
||||
return error;
|
||||
@ -4768,7 +4768,7 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u)
|
||||
if (create_info->or_replace())
|
||||
{
|
||||
/* Original table was deleted. We have to log it */
|
||||
log_drop_table(thd, &create_table->db, &create_table->table_name,
|
||||
log_drop_table(thd, &table_list->db, &table_list->table_name,
|
||||
&create_info->org_storage_engine_name,
|
||||
create_info->db_type == partition_hton,
|
||||
&create_info->org_tabledef_version,
|
||||
@ -4788,7 +4788,7 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u)
|
||||
list to keep them inaccessible from inner statements.
|
||||
e.g. CREATE TEMPORARY TABLE `t1` AS SELECT * FROM `t1`;
|
||||
*/
|
||||
saved_tmp_table_share= thd->save_tmp_table_share(create_table->table);
|
||||
saved_tmp_table_share= thd->save_tmp_table_share(table_list->table);
|
||||
}
|
||||
|
||||
if (extra_lock)
|
||||
@ -5087,8 +5087,8 @@ bool select_create::send_eof()
|
||||
*/
|
||||
wsrep_key_arr_t key_arr= {0, 0};
|
||||
wsrep_prepare_keys_for_isolation(thd,
|
||||
create_table->db.str,
|
||||
create_table->table_name.str,
|
||||
table_list->db.str,
|
||||
table_list->table_name.str,
|
||||
table_list,
|
||||
&key_arr);
|
||||
int rcode= wsrep_thd_append_key(thd, key_arr.keys, key_arr.keys_len,
|
||||
@ -5144,8 +5144,8 @@ bool select_create::send_eof()
|
||||
else
|
||||
lex_string_set(&ddl_log.org_storage_engine_name,
|
||||
ha_resolve_storage_engine_name(create_info->db_type));
|
||||
ddl_log.org_database= create_table->db;
|
||||
ddl_log.org_table= create_table->table_name;
|
||||
ddl_log.org_database= table_list->db;
|
||||
ddl_log.org_table= table_list->table_name;
|
||||
ddl_log.org_table_id= create_info->tabledef_version;
|
||||
backup_log_ddl(&ddl_log);
|
||||
}
|
||||
@ -5260,7 +5260,7 @@ void select_create::abort_result_set()
|
||||
m_plock= NULL;
|
||||
}
|
||||
|
||||
drop_open_table(thd, table, &create_table->db, &create_table->table_name);
|
||||
drop_open_table(thd, table, &table_list->db, &table_list->table_name);
|
||||
table=0; // Safety
|
||||
if (thd->log_current_statement())
|
||||
{
|
||||
@ -5275,7 +5275,7 @@ void select_create::abort_result_set()
|
||||
ddl_log_update_xid(&ddl_log_state_create, thd->binlog_xid);
|
||||
ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid);
|
||||
debug_crash_here("ddl_log_create_before_binlog");
|
||||
log_drop_table(thd, &create_table->db, &create_table->table_name,
|
||||
log_drop_table(thd, &table_list->db, &table_list->table_name,
|
||||
&create_info->org_storage_engine_name,
|
||||
create_info->db_type == partition_hton,
|
||||
&create_info->tabledef_version,
|
||||
@ -5291,8 +5291,8 @@ void select_create::abort_result_set()
|
||||
ddl_log.query= { C_STRING_WITH_LEN("DROP_AFTER_CREATE") };
|
||||
ddl_log.org_partitioned= (create_info->db_type == partition_hton);
|
||||
ddl_log.org_storage_engine_name= create_info->org_storage_engine_name;
|
||||
ddl_log.org_database= create_table->db;
|
||||
ddl_log.org_table= create_table->table_name;
|
||||
ddl_log.org_database= table_list->db;
|
||||
ddl_log.org_table= table_list->table_name;
|
||||
ddl_log.org_table_id= create_info->tabledef_version;
|
||||
backup_log_ddl(&ddl_log);
|
||||
}
|
||||
|
Reference in New Issue
Block a user