mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Bug#37016: TRUNCATE TABLE removes some rows but not all
The special TRUNCATE TABLE (DDL) transaction wasn't being properly rolled back if a error occurred during row by row deletion. The error can be caused by a foreign key restriction imposed by InnoDB SE and would cause the server to erroneously issue a implicit commit. The solution is to rollback the transaction if a truncation via row by row deletion fails, otherwise commit. All effects of a TRUNCATE ABLE operation are rolled back if a row by row deletion fails.
This commit is contained in:
@ -683,10 +683,10 @@ SUCCESS
|
||||
# 23. DDL: RENAME TEMPORARY TABLE, does not start a transaction
|
||||
|
||||
# No test because of Bug#8729 "rename table fails on temporary table"
|
||||
# 24. DDL: TRUNCATE TEMPORARY TABLE, does not start a transaction
|
||||
# 24. DDL: TRUNCATE TEMPORARY TABLE
|
||||
|
||||
truncate table t2;
|
||||
call p_verify_status_increment(2, 0, 2, 0);
|
||||
call p_verify_status_increment(4, 0, 4, 0);
|
||||
SUCCESS
|
||||
|
||||
commit;
|
||||
@ -853,7 +853,7 @@ call p_verify_status_increment(1, 0, 1, 0);
|
||||
SUCCESS
|
||||
|
||||
truncate table t3;
|
||||
call p_verify_status_increment(2, 2, 2, 2);
|
||||
call p_verify_status_increment(4, 4, 2, 2);
|
||||
SUCCESS
|
||||
|
||||
create view v1 as select * from t2;
|
||||
|
Reference in New Issue
Block a user