Bug #17092 allowing TRUNCATE TABLE while LOCKing done.
Submitted: 3 Feb 2006 8:34
Reporter: vijay patel
Status: Open
Category:Server Severity:S4 (Feature request)
Version: OS:
Assigned to: Target Version:
Triage: D5 (Feature request)

[3 Feb 2006 8:34] vijay patel
Description:
I required to use same type of usage described in "7.3.1. Locking Methods" --

LOCK TABLES real_table WRITE, tmp_insert WRITE;
INSERT INTO tmp_insert VALUES (.....);
SELECT COUNT(DISTINCT(col1)) AS cnt_tmp_insert FROM tmp_insert;
....c code here....
if (cnt_tmp_insert > 1,000,000,000) {
INSERT INTO real_table SELECT * FROM tmp_insert;
TRUNCATE TABLE tmp_insert;
}
UNLOCK TABLES;

In future version, I request to facilitate use TRUNCATE TABLE query while LOCK TABLES is
done on same table.

How to repeat:
LOCK TABLES real_table WRITE, tmp_insert WRITE;
INSERT INTO tmp_insert VALUES (.....);
SELECT COUNT(DISTINCT(col1)) AS cnt_tmp_insert FROM tmp_insert;
....c code here....
if (cnt_tmp_insert > 1,000,000,000) {
INSERT INTO real_table SELECT * FROM tmp_insert;
TRUNCATE TABLE tmp_insert;
}
UNLOCK TABLES;