Repository: edgedb/edgedb-python (language: python)

Issue:
Arrays of enum values cannot be used in parameters
This works:

```python
client.query("select <schema::Cardinality>$param;", param="One")
```

This does not work:

```python
client.query("select <array<schema::Cardinality>>$param;", param=["One"])
```

This behavior is inconsistent. The issue can be worked around using a double cast, but the DX is not ideal.

- EdgeDB version: `2.9`
- `edgedb-python` version: `1.2.0`


Discussion / hints:
I ran into this problem too. My solution (for now) was use a string instead.

Fix patch:
diff --git a/edgedb/protocol/codecs/array.pyx b/edgedb/protocol/codecs/array.pyx
index 34cc567b..fb0f872b 100644
--- a/edgedb/protocol/codecs/array.pyx
+++ b/edgedb/protocol/codecs/array.pyx
@@ -39,7 +39,7 @@ cdef class BaseArrayCodec(BaseCodec):
 
         if not isinstance(
             self.sub_codec,
-            (ScalarCodec, TupleCodec, NamedTupleCodec, RangeCodec)
+            (ScalarCodec, TupleCodec, NamedTupleCodec, RangeCodec, EnumCodec)
         ):
             raise TypeError(
                 'only arrays of scalars are supported (got type {!r})'.format(


Test patch:
diff --git a/tests/test_enum.py b/tests/test_enum.py
index a5e99b15..86bf40b6 100644
--- a/tests/test_enum.py
+++ b/tests/test_enum.py
@@ -99,3 +99,12 @@ async def test_enum_03(self):
         c_red = await self.client.query_single('SELECT <Color>"red"')
         c_red2 = await self.client.query_single('SELECT <Color>$0', c_red)
         self.assertIs(c_red, c_red2)
+
+    async def test_enum_04(self):
+        enums = await self.client.query_single(
+            'SELECT <array<Color>>$0', ['red', 'white']
+        )
+        enums2 = await self.client.query_single(
+            'SELECT <array<Color>>$0', enums
+        )
+        self.assertEqual(enums, enums2)