I have a partitioning script that essentially does the following:
drop table if exists a_old
rename table a to a_old
create table a like a_old
alter table a drop primary key, add primary key
alter table a partition by…
insert into a (select * from a_old)
drop table a_old
The problem is that for step 2, I need to specify a rollback. Basically, if the server goes down after step 1 and 2 , I want to specify arollback .
Now it can’t be:
rename table a_old to a (because I am dropping a_old at the end)
But ideally I want
if a_old exists, please rename a_old to a, else do nothing during rollback.
But I could not get anything to do this. Would appreciate some help!