Skip to content

Commit

Permalink
switched back to using cascade
Browse files Browse the repository at this point in the history
  • Loading branch information
jortiz16 committed Jun 10, 2015
1 parent 58e5ab9 commit 04e6cfb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ public void dropAndRenameTables(final RelationKey oldRelation, final RelationKey
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException {
switch (jdbcInfo.getDbms()) {
case MyriaConstants.STORAGE_SYSTEM_MYSQL:
throw new UnsupportedOperationException("MySQL does not support DROP IF EXISTS...CASCADE operations");
LOGGER.warn("MySQL does not implement DROP TABLE...CASCADE, attempting DROP TABLE instead");
execute("DROP TABLE IF EXISTS " + quote(relationKey));
break;
case MyriaConstants.STORAGE_SYSTEM_POSTGRESQL:
execute("DROP TABLE IF EXISTS " + quote(relationKey) + " CASCADE");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ public void dropTableIfExists(final RelationKey relationKey) throws DbException

@Override
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException {
throw new UnsupportedOperationException("SQLite does not support DROP IF EXISTS...CASCADE operations");
LOGGER.warn("SQLite does not implement DROP TABLE...CASCADE, attempting DROP TABLE instead");
execute("DROP TABLE IF EXISTS " + relationKey.toString(MyriaConstants.STORAGE_SYSTEM_SQLITE));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/edu/washington/escience/myria/operator/DbDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void init(final ImmutableMap<String, Object> execEnvVars) throws DbExc
accessMethod = AccessMethod.of(connectionInfo.getDbms(), connectionInfo, false);

/* Drop the table */
accessMethod.dropTableIfExists(relationKey);
accessMethod.dropTableIfExistsCascade(relationKey);
}

@Override
Expand Down

1 comment on commit 04e6cfb

@senderista
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess consensus is that best-effort semantics is appropriate here, so looks good.

Please sign in to comment.