Bug #42878 Federated doesn't distinguish between DELETE FROM t1 and TRUNCATE t1
Submitted: 16 Feb 2009 12:17 Modified: 10 Oct 2014 21:09
Reporter: Sergey Vojtovich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Federated storage engine Severity:S3 (Non-critical)
Version:5.0, 5,1, 6.0 bzr OS:Any
Assigned to: CPU Architecture:Any

[16 Feb 2009 12:17] Sergey Vojtovich
Description:
Both DELETE FROM t1 and TRUNCATE t1 are sent as TRUNCATE t1 to the remote table, where t1 is a federated table.

How to repeat:
Issue DELETE FROM t1 against Federated table and watch query log on a remote host. There may be more side effects with transactions (TRUNCATE is a DDL, but DELETE is DML) and probably with auto increment.

Suggested fix:
Fix ha_federated::delete_all_rows(), so it is issuing proper query to the remote table.
[16 Feb 2009 13:01] Sveta Smirnova
Thank you for the report.

Verified as described: both statements send to remote server as TRUNCATE
[10 Oct 2014 21:09] Paul DuBois
Noted in 5.7.6 changelog.

For FEDERATED tables, DELETE FROM tbl_name statements were sent to
the remote server as TRUNCATE TABLE tbl_name statements, with
possible side effects on transaction handling and AUTO_INCREMENT
processing.