--- /dev/null
+.. change::
+ :tags: bug, postgresql
+ :tickets: 9773
+
+ Fixed apparently very old issue where the
+ :paramref:`_postgresql.ENUM.create_type` parameter, when set to its
+ non-default of ``False``, would not be propagated when the
+ :class:`_schema.Column` which it's a part of were copied, as is common when
+ using ORM Declarative mixins.
kw.setdefault("values_callable", impl.values_callable)
kw.setdefault("omit_aliases", impl._omit_aliases)
kw.setdefault("_adapted_from", impl)
+ if type_api._is_native_for_emulated(impl.__class__):
+ kw.setdefault("create_type", impl.create_type)
+
return cls(**kw)
def create(self, bind=None, checkfirst=True):
# as only the default logic is implemented.
return cls.adapt_native_to_emulated(self, **kw)
else:
+ # this would be, both classes are Enum, or both classes
+ # are postgresql.ENUM
if issubclass(cls, self.__class__):
return self.adapt_to_emulated(cls, **kw)
else:
is_(e2.native_enum, True)
is_(e3.native_enum, True)
+ @testing.combinations(
+ ("name", "foobar", "name"),
+ ("validate_strings", True, "validate_strings"),
+ ("omit_aliases", False, "_omit_aliases"),
+ ("create_type", False, "create_type"),
+ ("create_type", True, "create_type"),
+ ("schema", "someschema", "schema"),
+ ("inherit_schema", True, "inherit_schema"),
+ ("metadata", MetaData(), "metadata"),
+ ("values_callable", lambda x: None, "values_callable"),
+ )
+ def test_enum_copy_args(self, argname, value, attrname):
+ kw = {argname: value}
+ e1 = ENUM("a", "b", "c", **kw)
+
+ e1_copy = e1.copy()
+
+ eq_(getattr(e1_copy, attrname), value)
+
def test_enum_create_table(self, metadata, connection):
metadata = self.metadata
t1 = Table(