>>>>> "web" == web <web@stripped> writes:
>> Description:
mysql> create temporary table a ( z tinyint );
web> Query OK, 0 rows affected (0.22 sec)
mysql> delete from a;
web> ERROR 1146: Table 'a' doesn't exist
<cut>
web> Server version 3.23.4-alpha
Sorry, but I didn't have time to get this into MySQL 3.23.5
Here is however a patch for this:
*** /my/monty/master/mysql-3.23.5-alpha/sql/mysql_priv.h Tue Oct 12 19:30:38 1999
--- ./mysql_priv.h Wed Oct 20 12:48:31 1999
***************
*** 318,324 ****
void close_temporary_tables(THD *thd);
TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name);
bool close_temporary_table(THD *thd, const char *db, const char *table_name);
! void close_temporary(TABLE *table);
bool rename_temporary_table(TABLE *table, const char *new_db,
const char *table_name);
void remove_db_from_cache(const my_string db);
--- 318,324 ----
void close_temporary_tables(THD *thd);
TABLE **find_temporary_table(THD *thd, const char *db, const char *table_name);
bool close_temporary_table(THD *thd, const char *db, const char *table_name);
! void close_temporary(TABLE *table, bool delete_table=1);
bool rename_temporary_table(TABLE *table, const char *new_db,
const char *table_name);
void remove_db_from_cache(const my_string db);
*** /my/monty/master/mysql-3.23.5-alpha/sql/sql_base.cc Mon Aug 30 00:03:07 1999
--- ./sql_base.cc Wed Oct 20 13:13:38 1999
***************
*** 364,370 ****
/* Close and delete temporary tables */
! void close_temporary(TABLE *table)
{
DBUG_ENTER("close_temporary");
char path[FN_REFLEN];
--- 364,370 ----
/* Close and delete temporary tables */
! void close_temporary(TABLE *table,bool delete_table)
{
DBUG_ENTER("close_temporary");
char path[FN_REFLEN];
***************
*** 373,379 ****
free_io_cache(table);
closefrm(table);
my_free((char*) table,MYF(0));
! rm_temporary_table(table_type, path);
DBUG_VOID_RETURN;
}
--- 373,380 ----
free_io_cache(table);
closefrm(table);
my_free((char*) table,MYF(0));
! if (delete_table)
! rm_temporary_table(table_type, path);
DBUG_VOID_RETURN;
}
*** /my/monty/master/mysql-3.23.5-alpha/sql/sql_delete.cc Wed Sep 8 17:47:38 1999
--- ./sql_delete.cc Wed Oct 20 13:13:10 1999
***************
*** 26,59 ****
{
char path[FN_REFLEN];
int error;
DBUG_ENTER("generate_table");
thd->proc_info="generate_table";
! (void) sprintf(path,"%s/%s/%s%s",mysql_data_home,table_list->db,
! table_list->real_name,reg_ext);
!
! VOID(pthread_mutex_lock(&LOCK_open));
! if (locked_table)
! mysql_lock_abort(locked_table); // end threads waiting on lock
! // close all copies in use
! if (remove_table_from_cache(table_list->db,table_list->real_name))
{
! if (!locked_table)
{
! VOID(pthread_mutex_unlock(&LOCK_open));
! DBUG_RETURN(1); // We must get a lock on table
}
}
- if (locked_table)
- VOID(ha_extra(locked_table,HA_EXTRA_FORCE_REOPEN)); // Close all NISAM files
- if (thd->locked_tables)
- close_data_tables(thd,table_list->db,table_list->real_name);
else
! close_thread_tables(thd,1);
! error= ha_create_table(path,(ulonglong) 0) ? -1 : 0;
! if (thd->locked_tables && reopen_tables(thd,1,0))
! error= -1;
! VOID(pthread_mutex_unlock(&LOCK_open));
if (!error)
{
send_ok(&thd->net); // This should return record count
--- 26,81 ----
{
char path[FN_REFLEN];
int error;
+ TABLE **table_ptr;
DBUG_ENTER("generate_table");
thd->proc_info="generate_table";
! /* If it is a temporary table, close and regenerate it */
! if ((table_ptr=find_temporary_table(thd,table_list->db,
! table_list->real_name)))
{
! TABLE *table= *table_ptr;
! ha_info(table,0);
! ulonglong auto_increment_value= table->keyfile_info.auto_increment_value;
! db_type table_type=table->db_type;
!
! strmov(path,table->path);
! *table_ptr= table->next; // Unlink table from list
! close_temporary(table,0);
! ha_create_table(path, auto_increment_value);
! if ((error= (int) !(open_temporary_table(thd, path, table_list->db,
! table_list->real_name, 1))))
{
! (void) rm_temporary_table(table_type, path);
}
}
else
! {
! (void) sprintf(path,"%s/%s/%s%s",mysql_data_home,table_list->db,
! table_list->real_name,reg_ext);
! VOID(pthread_mutex_lock(&LOCK_open));
! if (locked_table)
! mysql_lock_abort(locked_table); // end threads waiting on lock
! // close all copies in use
! if (remove_table_from_cache(table_list->db,table_list->real_name))
! {
! if (!locked_table)
! {
! VOID(pthread_mutex_unlock(&LOCK_open));
! DBUG_RETURN(1); // We must get a lock on table
! }
! }
! if (locked_table)
! VOID(ha_extra(locked_table,HA_EXTRA_FORCE_REOPEN)); // Close all NISAM files
! if (thd->locked_tables)
! close_data_tables(thd,table_list->db,table_list->real_name);
! else
! close_thread_tables(thd,1);
! error= ha_create_table(path,(ulonglong) 0) ? -1 : 0;
! if (thd->locked_tables && reopen_tables(thd,1,0))
! error= -1;
! VOID(pthread_mutex_unlock(&LOCK_open));
! }
if (!error)
{
send_ok(&thd->net); // This should return record count
Regards,
Monty