diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-22 14:04:20 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-01-22 14:04:20 -0500 |
commit | 09a503e49724b61a8119f0b7855a990a29fc1521 (patch) | |
tree | dc2c87cc9291f31b99c2248beb42f26e0f70786d /test/orm/inheritance/test_basic.py | |
parent | c9a1e570ad68028e0de0551155caeae313c9c7fd (diff) | |
download | sqlalchemy-09a503e49724b61a8119f0b7855a990a29fc1521.tar.gz |
- [bug] Fixed bug whereby a table-bound Column
object named "<a>_<b>" which matched a column
labeled as "<tablename>_<colname>" could match
inappropriately when targeting in a result
set row. [ticket:2377]
- requires that we change the tuple format in RowProxy.
Makes an improvement to the cases tested against
an unpickled RowProxy as well though doesn't solve the
problem there entirely.
Diffstat (limited to 'test/orm/inheritance/test_basic.py')
-rw-r--r-- | test/orm/inheritance/test_basic.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/orm/inheritance/test_basic.py b/test/orm/inheritance/test_basic.py index 7e64f08a0..015c7756b 100644 --- a/test/orm/inheritance/test_basic.py +++ b/test/orm/inheritance/test_basic.py @@ -2063,3 +2063,35 @@ class PolymorphicUnionTest(fixtures.TestBase, testing.AssertsCompiledSQL): "NULL AS c4, t3.c5, 'c' AS q1 FROM t3" ) + +class NameConflictTest(fixtures.MappedTest): + @classmethod + def define_tables(cls, metadata): + content = Table('content', metadata, + Column('id', Integer, primary_key=True, + test_needs_autoincrement=True), + Column('type', String(30)) + ) + foo = Table('foo', metadata, + Column('id', Integer, ForeignKey('content.id'), + primary_key=True), + Column('content_type', String(30)) + ) + + def test_name_conflict(self): + class Content(object): + pass + class Foo(Content): + pass + mapper(Content, self.tables.content, + polymorphic_on=self.tables.content.c.type) + mapper(Foo, self.tables.foo, inherits=Content, + polymorphic_identity='foo') + sess = create_session() + f = Foo() + f.content_type = u'bar' + sess.add(f) + sess.flush() + f_id = f.id + sess.expunge_all() + assert sess.query(Content).get(f_id).content_type == u'bar' |