Bug #56597 TRUNCATE command triggers 'safe updates' warning

Submitted: 6 Sep 2010 14:15 Modified: 29 Sep 2010 16:53
Reporter: Alex Whitman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S3 (Non-critical)
Version:5.2.27 OS:Windows (Windows 7)
Assigned to: Alfredo Kojima CPU Architecture:Any
Tags: SQL, truncate

[6 Sep 2010 14:15] Alex Whitman
Description:
When running a TRUNCATE command in the SQL editor with 'safe updates' enabled, the following error is produced:

Error Code: 1175
You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

How to repeat:
- Turn on 'safe updates' on the SQL Editor tab of preferences.
- Create a new table with a primary key column.
- In the SQL editor, run 'TRUNCATE <table>;'
- View error.

Suggested fix:
Either exclude TRUNCATE from triggering the error or rephrase error message as TRUNCATE doesn't use a WHERE clause.
[7 Sep 2010 8:29] Valeriy Kravchuk
Yes, it would be nice to get more specific error message in this case.
[14 Sep 2010 4:44] Alfredo Kojima
extended the error message suggesting to toggle the safe mode option and reconnect
[24 Sep 2010 15:31] Johannes Taxacher
confirmed in release 5.2.28
[29 Sep 2010 16:53] Tony Bedford
An entry was added to the 5.2.28 changelog:

When running a TRUNCATE command in the SQL editor with 'safe updates' enabled, the following error was produced:

Error Code: 1175
You are using safe update mode and you tried to update a table without a WHERE that uses
a KEY column

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

Page generated in 0.040 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.