]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed bug whereby inheritance discriminator part of a
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 21 Jul 2009 20:25:36 +0000 (20:25 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 21 Jul 2009 20:25:36 +0000 (20:25 +0000)
composite primary key would fail on updates.
Continuation of [ticket:1300].

CHANGES
lib/sqlalchemy/orm/mapper.py
test/orm/inheritance/test_basic.py

diff --git a/CHANGES b/CHANGES
index f6d89c29d91ecfcfa08aae26c6a7af14b5c36bfc..8fb09fc2d378f95efbd96ffba611e364285a76ea 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,11 @@ CHANGES
 =======
 0.5.6
 =====
+- orm
+    - Fixed bug whereby inheritance discriminator part of a
+      composite primary key would fail on updates.
+      Continuation of [ticket:1300].
+      
 - sql
     - Fixed a bug in extract() introduced in 0.5.4 whereby
       the string "field" argument was getting treated as a 
index b84f0166a422e40047cd5ce04fad0ad034eff2d2..ab6ff1c203be0ae669e3609a1b2076c4a7460ce5 100644 (file)
@@ -1328,7 +1328,7 @@ class Mapper(object):
                                 history = attributes.get_state_history(state, prop.key, passive=True)
                                 if history.added:
                                     hasdata = True
-                        elif mapper.polymorphic_on and mapper.polymorphic_on.shares_lineage(col):
+                        elif mapper.polymorphic_on and mapper.polymorphic_on.shares_lineage(col) and col not in pks:
                             pass
                         else:
                             if post_update_cols is not None and col not in post_update_cols:
index fc4aae17d5c82ab4a49297924268e0840bc1bd8f..213f2ebf4b82042310b0db8537ab9eadda34eafd 100644 (file)
@@ -985,6 +985,14 @@ class PKDiscriminatorTest(_base.MappedTest):
         assert a.id
         assert a.type == 2
         
+        p.name='p1new'
+        a.name='a1new'
+        s.flush()
+        
+        s.expire_all()
+        assert a.name=='a1new'
+        assert p.name=='p1new'
+        
         
 class DeleteOrphanTest(_base.MappedTest):
     @classmethod