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?

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

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