Bug #6798 Create table delete if exist
Submitted: 24 Nov 2004 14:47 Modified: 9 Feb 2006 12:07
Reporter: Olaf van der Spek (Basic Quality Contributor) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:* OS:Any (*)
Assigned to: CPU Architecture:Any

[24 Nov 2004 14:47] Olaf van der Spek
Description:
This feature would allow you to create a table, ensure it's empty, and insert data with a single query.
Could this extension be added?

How to repeat:
create table if not exists a ...;
truncate a;

Suggested fix:
create table delete if exists a ...;
[9 Feb 2006 12:07] Valeriy Kravchuk
Thank you for a feature request. Sorry, but I do not think that we have to add more non-standard extensions to the CREATE TABLE statement, for each and every possible usage in scripts. Why not just to check for table name in INFORMATION_SCHEMA table(s) and truncate it, if it already exists?