Bug #101689 Allow IF EXISTS for TRUNCATE TABLE

Submitted: 20 Nov 2020 6:41 Modified: 20 Nov 2020 7:05
Reporter: Darrell Duane Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: DDL Severity:S4 (Feature request)
Version:5.7, 8.0 OS:Any
Assigned to: CPU Architecture:Any

[20 Nov 2020 6:41] Darrell Duane
Description:
I have a script that I run to truncate tables on various instances of the Drupal CMS.  Some instances don't have the same cache tables as others.

Its very nice that DROP TABLE IF EXISTS 'table_name'   works
and frustrating that
TRUNCATE TABLE IF EXISTS 'table_name'  is not supported.  Please support "IF EXISTS" for TRUNCATE.

How to repeat:
thats all

Suggested fix:
Implement the same code that supports IF EXISTS for DROP to also work for TRUNCATE
[20 Nov 2020 7:05] MySQL Verification Team
Hello Darrell Duane,

Thank you for the feature request.
Imho this is duplicate of Bug #61890, please see Bug #61890

regards,
Umesh

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

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