Skip to content

Commit

Permalink
Merge pull request #691 from passuf/master
Browse files Browse the repository at this point in the history
Improve performance of get_deleted() when using Oracle
  • Loading branch information
etianen committed Dec 21, 2017
2 parents 0b2e5aa + 6aea2a3 commit 926cc2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions reversion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ def get_deleted(self, model, model_db=None):
# Try to do a faster JOIN.
model_db = model_db or router.db_for_write(model)
connection = connections[self.db]
if self.db == model_db and connection.vendor in ("sqlite", "postgresql"):
if self.db == model_db and connection.vendor in ("sqlite", "postgresql", "oracle"):
content_type = _get_content_type(model, self.db)
subquery = SubquerySQL(
"""
SELECT MAX(V.{id})
FROM {version} AS V
FROM {version} V
LEFT JOIN {model} ON V.{object_id} = CAST({model}.{model_id} as {str})
WHERE
V.{db} = %s AND
Expand Down

0 comments on commit 926cc2c

Please sign in to comment.