summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/dependency.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/dependency.py')
-rw-r--r--lib/sqlalchemy/orm/dependency.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py
index 34a2af391..0d5a4f909 100644
--- a/lib/sqlalchemy/orm/dependency.py
+++ b/lib/sqlalchemy/orm/dependency.py
@@ -741,10 +741,15 @@ class ManyToOneDP(DependencyProcessor):
self.key,
attributes.PASSIVE_NO_INITIALIZE)
if history:
- for child in history.added:
- self._synchronize(state, child, None, False,
- uowcommit, "add")
-
+ if history.added:
+ for child in history.added:
+ self._synchronize(state, child, None, False,
+ uowcommit, "add")
+ elif history.unchanged == [None]:
+ # this is to appease the case where our row
+ # here is in fact going to be a so-called "row switch",
+ # where an INSERT becomes an UPDATE. See #3060.
+ self._synchronize(state, None, None, True, uowcommit)
if self.post_update:
self._post_update(state, uowcommit, history.sum())