From: Mike Bayer Date: Tue, 21 Jul 2009 20:25:36 +0000 (+0000) Subject: - Fixed bug whereby inheritance discriminator part of a X-Git-Tag: rel_0_5_6~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f300bb43dedd54a81f5bd72fd9afad1c2bb39ede;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed bug whereby inheritance discriminator part of a composite primary key would fail on updates. Continuation of [ticket:1300]. --- diff --git a/CHANGES b/CHANGES index f6d89c29d9..8fb09fc2d3 100644 --- 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 diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index b84f0166a4..ab6ff1c203 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 fc4aae17d5..213f2ebf4b 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