<< Back to previous view

[JDBC-70] create-table if-not-exists Created: 12/Oct/13  Updated: 01/Jun/16  Resolved: 21/Nov/13

Status: Closed
Project: java.jdbc
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Enhancement Priority: Minor
Reporter: Jacob Rask Assignee: Sean Corfield
Resolution: Declined Votes: 0
Labels: None


sqlite has the IF NOT EXISTS clause to CREATE TABLE, but there doesn't seem to be an easy way to use it through jdbc.

It is usually an error to attempt to create a new table in a database that already contains a table, index or view of the same name. However, if the "IF NOT EXISTS" clause is specified as part of the CREATE TABLE statement and a table or view of the same name already exists, the CREATE TABLE command simply has no effect (and no error message is returned). An error is still returned if the table cannot be created because of an existing index, even if the "IF NOT EXISTS" clause is specified.


Comment by Sean Corfield [ 03/Nov/13 9:40 PM ]

DROP TABLE supports this too (MySQL at least, no doubt others). DDL should provide a consistent way to add stuff like this.

Comment by Sean Corfield [ 21/Nov/13 11:12 PM ]

Based on recent feedback about the DSLs that crept into 0.3.0, I'm going to decline this and recommend efforts go toward adding DDL support to Justin Kramer's HoneySQL.

Comment by Sean Corfield [ 21/Nov/13 11:13 PM ]

Won't fix - DSLs are not growing here

Generated at Sun Dec 16 06:48:00 CST 2018 using JIRA 4.4#649-r158309.