Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Nov 14, 2018
2 parents d1e33ac + 1bce65a commit 3a9cf9d
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -651,6 +651,8 @@ private void createTemporaryTable(Session session, final Dialect dialect, final
private String createDeleteQuery(String objectTable, String tempTable, String idColumnName) {
if (getConfiguration().isUsingMySqlCompatible()) {
return createDeleteQueryAsJoin(objectTable, tempTable, idColumnName);
} else if (getConfiguration().isUsingPostgreSQL()) {
return createDeleteQueryAsJoinPostgreSQL(objectTable, tempTable, idColumnName);
} else {
// todo consider using join for other databases as well
return createDeleteQueryAsSubquery(objectTable, tempTable, idColumnName);
Expand All @@ -662,6 +664,10 @@ private String createDeleteQueryAsJoin(String objectTable, String tempTable, Str
+ "WHERE main." + idColumnName + " = temp.id";
}

private String createDeleteQueryAsJoinPostgreSQL(String objectTable, String tempTable, String idColumnName) {
return "delete from " + objectTable + " main using " + tempTable + " temp where main." + idColumnName + " = temp.id";
}

private String createDeleteQueryAsSubquery(String objectTable, String tempTable, String idColumnName) {
StringBuilder sb = new StringBuilder();
sb.append("delete from ").append(objectTable);
Expand Down

0 comments on commit 3a9cf9d

Please sign in to comment.