Bug #17092 allowing TRUNCATE TABLE while LOCKing done.

Submitted: 3 Feb 2006 7:34 Modified: 17 Dec 2010 13:17
Reporter: vijay patel Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[3 Feb 2006 7: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;

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.