]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed bug in 0.6-reworked "many-to-one" optimizations
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Mar 2010 01:05:17 +0000 (20:05 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 14 Mar 2010 01:05:17 +0000 (20:05 -0500)
such that a many-to-one that is against a non-primary key
column on the remote table (i.e. foreign key against a
UNIQUE column) will pull the "old" value in from the
database during a change, since if it's in the session
we will need it for proper history/backref accounting,
and we can't pull from the local identity map on a
non-primary key column. [ticket:1737] (test is pending)

CHANGES
lib/sqlalchemy/orm/strategies.py

diff --git a/CHANGES b/CHANGES
index dfaf4846f650e38ef078bff4824928dbed252172..b33bf4b26294bc3cd6f1e2e3e939a819d0210557 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -30,7 +30,16 @@ CHANGES
     on existing items.  Will still mark the attr as expired
     if the destination doesn't have the attr, though, which
     fulfills some contracts of deferred cols.  [ticket:1681]
-
+  
+  - Fixed bug in 0.6-reworked "many-to-one" optimizations
+    such that a many-to-one that is against a non-primary key
+    column on the remote table (i.e. foreign key against a 
+    UNIQUE column) will pull the "old" value in from the
+    database during a change, since if it's in the session
+    we will need it for proper history/backref accounting,
+    and we can't pull from the local identity map on a 
+    non-primary key column. [ticket:1737]
+    
   - session.merge() works with relations that specifically
     don't include "merge" in their cascade options - the target
     is ignored completely.
index eea7a8b1247987821d6cd513b2dfa33d28aa7ab3..bd96dd5b78a1a99273b45d3be880cc88316d4779 100644 (file)
@@ -377,7 +377,7 @@ class LazyLoader(AbstractRelationLoader):
                 callable_=self._class_level_loader,
                 uselist = self.parent_property.uselist,
                 typecallable = self.parent_property.collection_class,
-                active_history = self.parent_property.direction is not interfaces.MANYTOONE
+                active_history = not self.use_get
                 )
 
     def lazy_clause(self, state, reverse_direction=False, alias_secondary=False, adapt_source=None):