pos-fixes for rename

This commit is contained in:
Sergei Golubchik 2024-07-25 22:14:59 +02:00
parent 97e112fb82
commit 445198c10e
4 changed files with 7 additions and 8 deletions

View file

@ -344,8 +344,8 @@ t1#i#01.MYI
t1.MYD
t1.MYI
t1.frm
rename table test1.t2 to test1.t1;
ERROR 42S02: Table 'test1.t2' doesn't exist
rename table test1.t1 to test1.t2;
ERROR HY000: Error on rename of './test1/t1#i#01.MYD' to './test1/t2#i#01.MYD' (Errcode: 2 "No such file or directory")
db.opt
t1#i#01.MYI
t1.MYD

View file

@ -132,8 +132,8 @@ rename table test.t2 to test1.t1;
list_files $datadir/test1;
remove_file $datadir/test1/t1#i#01.MYD;
--error ER_NO_SUCH_TABLE
rename table test1.t2 to test1.t1;
--error 7
rename table test1.t1 to test1.t2;
list_files $datadir/test1;
drop database test1;
list_files $datadir/test;

View file

@ -5415,6 +5415,7 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
}
file->ha_rename_table(to_base, from_base);
rename_file_ext(to, from, reg_ext);
break;
}
}
}

View file

@ -36,10 +36,8 @@ int mi_rename(const char *old_name, const char *new_name)
save_errno= my_errno;
fn_format(from,old_name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
fn_format(to,new_name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
if (mysql_file_rename_with_symlink(mi_key_file_dfile,
from, to,
MYF(MY_WME)))
if (save_errno)
if (mysql_file_rename_with_symlink(mi_key_file_dfile, from, to, MYF(MY_WME)))
if (!save_errno)
save_errno= my_errno;
DBUG_RETURN(save_errno);
}