From ab01f893f8c489e2fe981699e022c76e0318ec77 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 1 Apr 2021 12:26:06 -0400 Subject: Correct for Variant + ARRAY cases in psycopg2 Fixed regression caused by :ticket:`6023` where the PostgreSQL cast operator applied to elements within an :class:`_types.ARRAY` when using psycopg2 would fail to use the correct type in the case that the datatype were also embedded within an instance of the :class:`_types.Variant` adapter. Additionally, repairs support for the correct CREATE TYPE to be emitted when using a ``Variant(ARRAY(some_schema_type))``. Fixes: #6182 Change-Id: I1b9ba7c876980d4650715a0b0801b46bdc72860d --- test/sql/test_metadata.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/sql') diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py index eb5e305a2..e2f015b00 100644 --- a/test/sql/test_metadata.py +++ b/test/sql/test_metadata.py @@ -2125,6 +2125,12 @@ class SchemaTypeTest(fixtures.TestBase): typ = MyType() self._test_before_parent_attach(typ) + def test_before_parent_attach_variant_array_schematype(self): + + target = Enum("one", "two", "three") + typ = ARRAY(target).with_variant(String(), "other") + self._test_before_parent_attach(typ, evt_target=target) + def _test_before_parent_attach(self, typ, evt_target=None): canary = mock.Mock() -- cgit v1.2.1