mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +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:
@ -6115,7 +6115,6 @@ class select_insert :public select_result_interceptor {
|
|||||||
|
|
||||||
|
|
||||||
class select_create: public select_insert {
|
class select_create: public select_insert {
|
||||||
TABLE_LIST *create_table;
|
|
||||||
Table_specification_st *create_info;
|
Table_specification_st *create_info;
|
||||||
TABLE_LIST *select_tables;
|
TABLE_LIST *select_tables;
|
||||||
Alter_info *alter_info;
|
Alter_info *alter_info;
|
||||||
@ -6136,7 +6135,6 @@ public:
|
|||||||
TABLE_LIST *select_tables_arg):
|
TABLE_LIST *select_tables_arg):
|
||||||
select_insert(thd_arg, table_arg, NULL, &select_fields, 0, 0, duplic,
|
select_insert(thd_arg, table_arg, NULL, &select_fields, 0, 0, duplic,
|
||||||
ignore, NULL),
|
ignore, NULL),
|
||||||
create_table(table_arg),
|
|
||||||
create_info(create_info_par),
|
create_info(create_info_par),
|
||||||
select_tables(select_tables_arg),
|
select_tables(select_tables_arg),
|
||||||
alter_info(alter_info_arg),
|
alter_info(alter_info_arg),
|
||||||
|
@ -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))
|
if (!(thd->variables.option_bits & OPTION_EXPLICIT_DEF_TIMESTAMP))
|
||||||
promote_first_timestamp_column(&alter_info->create_list);
|
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);
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
while ((item=it++))
|
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,
|
if (create_info->check_fields(thd, alter_info,
|
||||||
create_table->table_name,
|
table_list->table_name,
|
||||||
create_table->db))
|
table_list->db))
|
||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
DEBUG_SYNC(thd,"create_table_select_before_create");
|
DEBUG_SYNC(thd,"create_table_select_before_create");
|
||||||
|
|
||||||
/* Check if LOCK TABLES + CREATE OR REPLACE of existing normal table*/
|
/* 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())
|
!create_info->tmp_table())
|
||||||
{
|
{
|
||||||
/* Remember information about the locked table */
|
/* Remember information about the locked table */
|
||||||
create_info->pos_in_locked_tables=
|
create_info->pos_in_locked_tables=
|
||||||
create_table->table->pos_in_locked_tables;
|
table_list->table->pos_in_locked_tables;
|
||||||
create_info->mdl_ticket= create_table->table->mdl_ticket;
|
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,
|
if (!mysql_create_table_no_lock(thd, &ddl_log_state_create, &ddl_log_state_rm,
|
||||||
&create_table->db,
|
&table_list->db,
|
||||||
&create_table->table_name,
|
&table_list->table_name,
|
||||||
create_info, alter_info, NULL,
|
create_info, alter_info, NULL,
|
||||||
C_ORDINARY_CREATE, create_table))
|
C_ORDINARY_CREATE, table_list))
|
||||||
{
|
{
|
||||||
DEBUG_SYNC(thd,"create_table_select_before_open");
|
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,
|
If we had a temporary table or a table used with LOCK TABLES,
|
||||||
it was closed by mysql_create()
|
it was closed by mysql_create()
|
||||||
*/
|
*/
|
||||||
create_table->table= 0;
|
table_list->table= 0;
|
||||||
|
|
||||||
if (!create_info->tmp_table())
|
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;
|
TABLE_LIST::enum_open_strategy save_open_strategy;
|
||||||
|
|
||||||
/* Force the newly created table to be opened */
|
/* Force the newly created table to be opened */
|
||||||
save_open_strategy= create_table->open_strategy;
|
save_open_strategy= table_list->open_strategy;
|
||||||
create_table->open_strategy= TABLE_LIST::OPEN_NORMAL;
|
table_list->open_strategy= TABLE_LIST::OPEN_NORMAL;
|
||||||
/*
|
/*
|
||||||
Here we open the destination table, on which we already have
|
Here we open the destination table, on which we already have
|
||||||
an exclusive metadata lock.
|
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,
|
quick_rm_table(thd, create_info->db_type, &table_list->db,
|
||||||
table_case_name(create_info, &create_table->table_name),
|
table_case_name(create_info, &table_list->table_name),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
/* Restore */
|
/* Restore */
|
||||||
create_table->open_strategy= save_open_strategy;
|
table_list->open_strategy= save_open_strategy;
|
||||||
}
|
}
|
||||||
else
|
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
|
The pointer to the newly created temporary table has been stored in
|
||||||
table->create_info.
|
table->create_info.
|
||||||
*/
|
*/
|
||||||
create_table->table= create_info->table;
|
table_list->table= create_info->table;
|
||||||
if (!create_table->table)
|
if (!table_list->table)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
This shouldn't happen as creation of temporary table should make
|
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
|
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
|
if (likely(!thd->is_error())) // CREATE ... IF NOT EXISTS
|
||||||
my_ok(thd); // succeed, but did nothing
|
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);
|
mysql_unlock_tables(thd, *lock);
|
||||||
*lock= 0;
|
*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_rm);
|
||||||
ddl_log_complete(&ddl_log_state_create);
|
ddl_log_complete(&ddl_log_state_create);
|
||||||
DBUG_RETURN(NULL);
|
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.
|
NOTE: for row format CREATE TABLE must be logged before row data.
|
||||||
*/
|
*/
|
||||||
int error;
|
int error;
|
||||||
TABLE_LIST *save_next_global= create_table->next_global;
|
TABLE_LIST *save_next_global= table_list->next_global;
|
||||||
create_table->next_global= select_tables;
|
table_list->next_global= select_tables;
|
||||||
error= thd->decide_logging_format(create_table);
|
error= thd->decide_logging_format(table_list);
|
||||||
create_table->next_global= save_next_global;
|
table_list->next_global= save_next_global;
|
||||||
|
|
||||||
if (unlikely(error))
|
if (unlikely(error))
|
||||||
return error;
|
return error;
|
||||||
@ -4768,7 +4768,7 @@ select_create::prepare(List<Item> &_values, SELECT_LEX_UNIT *u)
|
|||||||
if (create_info->or_replace())
|
if (create_info->or_replace())
|
||||||
{
|
{
|
||||||
/* Original table was deleted. We have to log it */
|
/* 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->org_storage_engine_name,
|
||||||
create_info->db_type == partition_hton,
|
create_info->db_type == partition_hton,
|
||||||
&create_info->org_tabledef_version,
|
&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.
|
list to keep them inaccessible from inner statements.
|
||||||
e.g. CREATE TEMPORARY TABLE `t1` AS SELECT * FROM `t1`;
|
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)
|
if (extra_lock)
|
||||||
@ -5087,8 +5087,8 @@ bool select_create::send_eof()
|
|||||||
*/
|
*/
|
||||||
wsrep_key_arr_t key_arr= {0, 0};
|
wsrep_key_arr_t key_arr= {0, 0};
|
||||||
wsrep_prepare_keys_for_isolation(thd,
|
wsrep_prepare_keys_for_isolation(thd,
|
||||||
create_table->db.str,
|
table_list->db.str,
|
||||||
create_table->table_name.str,
|
table_list->table_name.str,
|
||||||
table_list,
|
table_list,
|
||||||
&key_arr);
|
&key_arr);
|
||||||
int rcode= wsrep_thd_append_key(thd, key_arr.keys, key_arr.keys_len,
|
int rcode= wsrep_thd_append_key(thd, key_arr.keys, key_arr.keys_len,
|
||||||
@ -5144,8 +5144,8 @@ bool select_create::send_eof()
|
|||||||
else
|
else
|
||||||
lex_string_set(&ddl_log.org_storage_engine_name,
|
lex_string_set(&ddl_log.org_storage_engine_name,
|
||||||
ha_resolve_storage_engine_name(create_info->db_type));
|
ha_resolve_storage_engine_name(create_info->db_type));
|
||||||
ddl_log.org_database= create_table->db;
|
ddl_log.org_database= table_list->db;
|
||||||
ddl_log.org_table= create_table->table_name;
|
ddl_log.org_table= table_list->table_name;
|
||||||
ddl_log.org_table_id= create_info->tabledef_version;
|
ddl_log.org_table_id= create_info->tabledef_version;
|
||||||
backup_log_ddl(&ddl_log);
|
backup_log_ddl(&ddl_log);
|
||||||
}
|
}
|
||||||
@ -5260,7 +5260,7 @@ void select_create::abort_result_set()
|
|||||||
m_plock= NULL;
|
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
|
table=0; // Safety
|
||||||
if (thd->log_current_statement())
|
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_create, thd->binlog_xid);
|
||||||
ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid);
|
ddl_log_update_xid(&ddl_log_state_rm, thd->binlog_xid);
|
||||||
debug_crash_here("ddl_log_create_before_binlog");
|
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->org_storage_engine_name,
|
||||||
create_info->db_type == partition_hton,
|
create_info->db_type == partition_hton,
|
||||||
&create_info->tabledef_version,
|
&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.query= { C_STRING_WITH_LEN("DROP_AFTER_CREATE") };
|
||||||
ddl_log.org_partitioned= (create_info->db_type == partition_hton);
|
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_storage_engine_name= create_info->org_storage_engine_name;
|
||||||
ddl_log.org_database= create_table->db;
|
ddl_log.org_database= table_list->db;
|
||||||
ddl_log.org_table= create_table->table_name;
|
ddl_log.org_table= table_list->table_name;
|
||||||
ddl_log.org_table_id= create_info->tabledef_version;
|
ddl_log.org_table_id= create_info->tabledef_version;
|
||||||
backup_log_ddl(&ddl_log);
|
backup_log_ddl(&ddl_log);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user