diff options
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | lib/sqlalchemy/orm/mapper.py | 2 | ||||
-rw-r--r-- | test/orm/inheritance/test_basic.py | 8 |
3 files changed, 14 insertions, 1 deletions
@@ -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 diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index b84f0166a..ab6ff1c20 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -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: diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index fc4aae17d..213f2ebf4 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -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 |