summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/persistence.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2014-03-28 17:42:55 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2014-03-28 17:42:55 -0400
commita0329f71ad48b16ad9dad44d5a5cb2c920e569f1 (patch)
tree42abf3abcf3ca3cd0a6ea55c55039c2d8896aee1 /lib/sqlalchemy/orm/persistence.py
parent477b9e7f0297e0f96781fb94501b505ee647970a (diff)
downloadsqlalchemy-a0329f71ad48b16ad9dad44d5a5cb2c920e569f1.tar.gz
- revert part of c01558ae7f4a for now as we also test that a DELETE of two rows
where one is to be deleted from ON DELETE CASCADE succeeds; the check here makes that fail. We will need to add an option to enable/disable this check per mapping, will likely do this in next version
Diffstat (limited to 'lib/sqlalchemy/orm/persistence.py')
-rw-r--r--lib/sqlalchemy/orm/persistence.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/persistence.py b/lib/sqlalchemy/orm/persistence.py
index b4c9c052b..d62e803ee 100644
--- a/lib/sqlalchemy/orm/persistence.py
+++ b/lib/sqlalchemy/orm/persistence.py
@@ -683,7 +683,18 @@ def _emit_delete_statements(base_mapper, uowtransaction, cached_connections,
rows_matched = -1
if connection.dialect.supports_sane_multi_rowcount:
c = connection.execute(statement, del_objects)
- rows_matched = c.rowcount
+
+ # only do a row check if we have versioning turned on.
+ # unfortunately, we *cannot* do a check on the number of
+ # rows matched here in general, as there is the edge case
+ # of a table that has a self-referential foreign key with
+ # ON DELETE CASCADE on it, see #2403. I'm not sure how we can
+ # resolve this, unless we require special configuration
+ # to enable "count rows" for certain mappings, or to disable
+ # it, or to based on it relationship(), not sure.
+ if need_version_id:
+ rows_matched = c.rowcount
+
elif need_version_id:
if connection.dialect.supports_sane_rowcount:
rows_matched = 0