--- /dev/null
+.. change::
+ :tags: bug, reflection, postgresql
+ :tickets: 12744
+
+ Fixes bug that would mistakenly interpret a domain or enum type
+ with name starting in ``interval`` as an ``INTERVAL`` type while
+ reflecting a table.
charlen = int(attype_args[0])
args = (charlen,)
- elif attype.startswith("interval"):
+ # a domain or enum can start with interval, so be mindful of that.
+ elif attype == "interval" or attype.startswith("interval "):
schema_type = INTERVAL
field_match = re.match(r"interval (.+)", attype)
t = Table("t", MetaData(), autoload_with=connection)
eq_(t.c.x.type.enums, [])
+ def test_enum_starts_with_interval(self, metadata, connection):
+ """Test for #12744"""
+ enum_type = postgresql.ENUM("day", "week", name="intervalunit")
+ t1 = Table("t1", metadata, Column("col", enum_type))
+ t1.create(connection)
+
+ insp = inspect(connection)
+ cols = insp.get_columns("t1")
+ is_true(isinstance(cols[0]["type"], postgresql.ENUM))
+ eq_(cols[0]["type"].enums, ["day", "week"])
+
def test_reflection_with_unique_constraint(self, metadata, connection):
insp = inspect(connection)