on dialect, but only works on Postgresql so far.
Courtesy Manlio Perillo, [ticket:1679]
+ - [bug] Fixed bug whereby TypeDecorator would
+ return a stale value for _type_affinity, when
+ using a TypeDecorator that "switches" types,
+ like the CHAR/UUID type.
+
- postgresql
- [bug] Postgresql dialect memoizes that an ENUM of a
particular name was processed
]:
eq_(t1._compare_type_affinity(t2), comp, "%s %s" % (t1, t2))
+ def test_decorator_doesnt_cache(self):
+ from sqlalchemy.dialects import postgresql
+
+ class MyType(TypeDecorator):
+ impl = CHAR
+
+ def load_dialect_impl(self, dialect):
+ if dialect.name == 'postgresql':
+ return dialect.type_descriptor(postgresql.UUID())
+ else:
+ return dialect.type_descriptor(CHAR(32))
+
+ t1 = MyType()
+ d = postgresql.dialect()
+ assert t1._type_affinity is String
+ assert t1.dialect_impl(d)._type_affinity is postgresql.UUID
+
class PickleMetadataTest(fixtures.TestBase):
def testmeta(self):
for loads, dumps in picklers():