We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Implement _array mathesar type
- [ ] Cell component for array type
- [ ] Type specific handling for items within array
- [ ] Handle filtering, grouping

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `mathesar/database/types.py`
Content:
```
1 """
2 This file describes UI data types and how they map to DB-layer database types (subclasses
3 of db.types.base.DatabaseType).
4 """
5 from enum import Enum
6 from collections.abc import Collection
7 from db.types.base import (
8     DatabaseType, PostgresType, MathesarCustomType
9 )
10 from db.types.hintsets import db_types_hinted
11 
12 
13 class UIType(Enum):
14     id: str  # noqa: NT001
15     display_name: str  # noqa: NT001
16     db_types: Collection[DatabaseType]  # noqa: NT001
17 
18     BOOLEAN = (
19         'boolean',
20         'Boolean',
21         {
22             PostgresType.BOOLEAN,
23         },
24     )
25     DATE = (
26         'date',
27         'Date',
28         {
29             PostgresType.DATE,
30         },
31     )
32     TIME = (
33         'time',
34         'Time',
35         {
36             PostgresType.TIME_WITH_TIME_ZONE,
37             PostgresType.TIME_WITHOUT_TIME_ZONE,
38         },
39     )
40     DATETIME = (
41         'datetime',
42         'Date & Time',
43         {
44             PostgresType.TIMESTAMP_WITH_TIME_ZONE,
45             PostgresType.TIMESTAMP_WITHOUT_TIME_ZONE,
46         },
47     )
48     DURATION = (
49         'duration',
50         'Duration',
51         {
52             PostgresType.INTERVAL,
53         },
54     )
55     EMAIL = (
56         'email',
57         'Email',
58         {
59             MathesarCustomType.EMAIL,
60         },
61     )
62     MONEY = (
63         'money',
64         'Money',
65         {
66             PostgresType.MONEY,
67             MathesarCustomType.MATHESAR_MONEY,
68             MathesarCustomType.MULTICURRENCY_MONEY,
69         }
70     )
71     NUMBER = (
72         'number',
73         'Number',
74         {
75             PostgresType.BIGINT,
76             PostgresType.DOUBLE_PRECISION,
77             PostgresType.INTEGER,
78             PostgresType.NUMERIC,
79             PostgresType.REAL,
80             PostgresType.SMALLINT,
81         }
82     )
83     TEXT = (
84         'text',
85         'Text',
86         {
87             PostgresType.CHARACTER,
88             PostgresType.CHARACTER_VARYING,
89             PostgresType.TEXT,
90             PostgresType.NAME,
91             PostgresType.CHAR,
92         },
93     )
94     URI = (
95         'uri',
96         'URI',
97         {
98             MathesarCustomType.URI,
99         }
100     )
101     JSON_ARRAY = (
102         'jsonlist',
103         'JSON List',
104         {
105             MathesarCustomType.MATHESAR_JSON_ARRAY,
106         }
107     )
108     JSON_OBJECT = (
109         'map',
110         'Map',
111         {
112             MathesarCustomType.MATHESAR_JSON_OBJECT,
113         }
114     )
115     # These are default Postgres types that we don't have specific behavior for yet in the UI.
116     OTHER = (
117         'other',
118         'Other',
119         {
120             PostgresType._ARRAY,
121             PostgresType.BIT_VARYING,
122             PostgresType.BIT,
123             PostgresType.BYTEA,
124             PostgresType.CIDR,
125             PostgresType.DATERANGE,
126             PostgresType.HSTORE,
127             PostgresType.INET,
128             PostgresType.INT4RANGE,
129             PostgresType.INT8RANGE,
130             PostgresType.JSON,
131             PostgresType.JSONB,
132             PostgresType.MACADDR,
133             PostgresType.NUMRANGE,
134             PostgresType.OID,
135             PostgresType.REGCLASS,
136             PostgresType.TSRANGE,
137             PostgresType.TSTZRANGE,
138             PostgresType.TSVECTOR,
139             PostgresType.UUID,
140         },
141     )
142 
143     def __new__(cls, ui_type_id, display_name, db_types):
144         """
145         The Enum is adapted to take three initial properties. Enum's value is set to be the first
146         property -- the id.
147         """
148         obj = object.__new__(cls)
149         obj._value_ = ui_type_id
150         obj.id = ui_type_id
151         obj.display_name = display_name
152         obj.db_types = frozenset(db_types)
153         return obj
154 
155     def __str__(self):
156         return self.id
157 
158 
159 def ui_types_that_satisfy_hintset(ui_types_mapped_to_hintsets, hintset):
160     """
161     Provided a mapping of UI types to their hintsets and a hintset, tries to find UI
162     types whose hintsets satisfy the passed hintset, meaning the UI types whose hintsets are
163     supersets of the passed hintset.
164     """
165     hintset = set(hintset)
166     return frozenset(
167         ui_type
168         for ui_type, ui_type_hintset
169         in ui_types_mapped_to_hintsets.items()
170         if set.issubset(hintset, ui_type_hintset)
171     )
172 
173 
174 def get_ui_types_mapped_to_hintsets():
175     """
176     Returns a dict where the keys are UI types and the values their hintsets.
177     A UI type's hintset is defined as the intersection of the hintsets of its associated
178     database types.
179     """
180     ui_types_mapped_to_hintsets = {}
181     for ui_type in UIType:
182         associated_db_types = ui_type.db_types
183         associated_db_type_hintsets = tuple(
184             set(db_types_hinted[associated_db_type])
185             for associated_db_type in associated_db_types
186             if associated_db_type in db_types_hinted
187         )
188         hintsets_intersection = _safe_set_intersection(associated_db_type_hintsets)
189         ui_types_mapped_to_hintsets[ui_type] = frozenset(hintsets_intersection)
190     return ui_types_mapped_to_hintsets
191 
192 
193 def _safe_set_intersection(sets):
194     # set.intersection fails if it is not passed anything.
195     if len(sets) > 0:
196         return set.intersection(*sets)
197     else:
198         return set()
199 
200 
201 def get_ui_type_from_db_type(db_type_to_find):
202     for ui_type in UIType:
203         associated_db_types = ui_type.db_types
204         if db_type_to_find in associated_db_types:
205             return ui_type
206 
207 
208 def get_ui_type_from_id(ui_type_id):
209     try:
210         return UIType(ui_type_id)
211     except ValueError:
212         return None
213
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/mathesar/database/types.py b/mathesar/database/types.py
--- a/mathesar/database/types.py
+++ b/mathesar/database/types.py
@@ -112,12 +112,18 @@
             MathesarCustomType.MATHESAR_JSON_OBJECT,
         }
     )
+    ARRAY = (
+        'array',
+        'Array',
+        {
+            PostgresType._ARRAY,
+        }
+    )
     # These are default Postgres types that we don't have specific behavior for yet in the UI.
     OTHER = (
         'other',
         'Other',
         {
-            PostgresType._ARRAY,
             PostgresType.BIT_VARYING,
             PostgresType.BIT,
             PostgresType.BYTEA,

{"golden_diff": "diff --git a/mathesar/database/types.py b/mathesar/database/types.py\n--- a/mathesar/database/types.py\n+++ b/mathesar/database/types.py\n@@ -112,12 +112,18 @@\n             MathesarCustomType.MATHESAR_JSON_OBJECT,\n         }\n     )\n+    ARRAY = (\n+        'array',\n+        'Array',\n+        {\n+            PostgresType._ARRAY,\n+        }\n+    )\n     # These are default Postgres types that we don't have specific behavior for yet in the UI.\n     OTHER = (\n         'other',\n         'Other',\n         {\n-            PostgresType._ARRAY,\n             PostgresType.BIT_VARYING,\n             PostgresType.BIT,\n             PostgresType.BYTEA,\n", "issue": "Implement _array mathesar type\n- [ ] Cell component for array type\r\n- [ ] Type specific handling for items within array\r\n- [ ] Handle filtering, grouping\n", "before_files": [{"content": "\"\"\"\nThis file describes UI data types and how they map to DB-layer database types (subclasses\nof db.types.base.DatabaseType).\n\"\"\"\nfrom enum import Enum\nfrom collections.abc import Collection\nfrom db.types.base import (\n    DatabaseType, PostgresType, MathesarCustomType\n)\nfrom db.types.hintsets import db_types_hinted\n\n\nclass UIType(Enum):\n    id: str  # noqa: NT001\n    display_name: str  # noqa: NT001\n    db_types: Collection[DatabaseType]  # noqa: NT001\n\n    BOOLEAN = (\n        'boolean',\n        'Boolean',\n        {\n            PostgresType.BOOLEAN,\n        },\n    )\n    DATE = (\n        'date',\n        'Date',\n        {\n            PostgresType.DATE,\n        },\n    )\n    TIME = (\n        'time',\n        'Time',\n        {\n            PostgresType.TIME_WITH_TIME_ZONE,\n            PostgresType.TIME_WITHOUT_TIME_ZONE,\n        },\n    )\n    DATETIME = (\n        'datetime',\n        'Date & Time',\n        {\n            PostgresType.TIMESTAMP_WITH_TIME_ZONE,\n            PostgresType.TIMESTAMP_WITHOUT_TIME_ZONE,\n        },\n    )\n    DURATION = (\n        'duration',\n        'Duration',\n        {\n            PostgresType.INTERVAL,\n        },\n    )\n    EMAIL = (\n        'email',\n        'Email',\n        {\n            MathesarCustomType.EMAIL,\n        },\n    )\n    MONEY = (\n        'money',\n        'Money',\n        {\n            PostgresType.MONEY,\n            MathesarCustomType.MATHESAR_MONEY,\n            MathesarCustomType.MULTICURRENCY_MONEY,\n        }\n    )\n    NUMBER = (\n        'number',\n        'Number',\n        {\n            PostgresType.BIGINT,\n            PostgresType.DOUBLE_PRECISION,\n            PostgresType.INTEGER,\n            PostgresType.NUMERIC,\n            PostgresType.REAL,\n            PostgresType.SMALLINT,\n        }\n    )\n    TEXT = (\n        'text',\n        'Text',\n        {\n            PostgresType.CHARACTER,\n            PostgresType.CHARACTER_VARYING,\n            PostgresType.TEXT,\n            PostgresType.NAME,\n            PostgresType.CHAR,\n        },\n    )\n    URI = (\n        'uri',\n        'URI',\n        {\n            MathesarCustomType.URI,\n        }\n    )\n    JSON_ARRAY = (\n        'jsonlist',\n        'JSON List',\n        {\n            MathesarCustomType.MATHESAR_JSON_ARRAY,\n        }\n    )\n    JSON_OBJECT = (\n        'map',\n        'Map',\n        {\n            MathesarCustomType.MATHESAR_JSON_OBJECT,\n        }\n    )\n    # These are default Postgres types that we don't have specific behavior for yet in the UI.\n    OTHER = (\n        'other',\n        'Other',\n        {\n            PostgresType._ARRAY,\n            PostgresType.BIT_VARYING,\n            PostgresType.BIT,\n            PostgresType.BYTEA,\n            PostgresType.CIDR,\n            PostgresType.DATERANGE,\n            PostgresType.HSTORE,\n            PostgresType.INET,\n            PostgresType.INT4RANGE,\n            PostgresType.INT8RANGE,\n            PostgresType.JSON,\n            PostgresType.JSONB,\n            PostgresType.MACADDR,\n            PostgresType.NUMRANGE,\n            PostgresType.OID,\n            PostgresType.REGCLASS,\n            PostgresType.TSRANGE,\n            PostgresType.TSTZRANGE,\n            PostgresType.TSVECTOR,\n            PostgresType.UUID,\n        },\n    )\n\n    def __new__(cls, ui_type_id, display_name, db_types):\n        \"\"\"\n        The Enum is adapted to take three initial properties. Enum's value is set to be the first\n        property -- the id.\n        \"\"\"\n        obj = object.__new__(cls)\n        obj._value_ = ui_type_id\n        obj.id = ui_type_id\n        obj.display_name = display_name\n        obj.db_types = frozenset(db_types)\n        return obj\n\n    def __str__(self):\n        return self.id\n\n\ndef ui_types_that_satisfy_hintset(ui_types_mapped_to_hintsets, hintset):\n    \"\"\"\n    Provided a mapping of UI types to their hintsets and a hintset, tries to find UI\n    types whose hintsets satisfy the passed hintset, meaning the UI types whose hintsets are\n    supersets of the passed hintset.\n    \"\"\"\n    hintset = set(hintset)\n    return frozenset(\n        ui_type\n        for ui_type, ui_type_hintset\n        in ui_types_mapped_to_hintsets.items()\n        if set.issubset(hintset, ui_type_hintset)\n    )\n\n\ndef get_ui_types_mapped_to_hintsets():\n    \"\"\"\n    Returns a dict where the keys are UI types and the values their hintsets.\n    A UI type's hintset is defined as the intersection of the hintsets of its associated\n    database types.\n    \"\"\"\n    ui_types_mapped_to_hintsets = {}\n    for ui_type in UIType:\n        associated_db_types = ui_type.db_types\n        associated_db_type_hintsets = tuple(\n            set(db_types_hinted[associated_db_type])\n            for associated_db_type in associated_db_types\n            if associated_db_type in db_types_hinted\n        )\n        hintsets_intersection = _safe_set_intersection(associated_db_type_hintsets)\n        ui_types_mapped_to_hintsets[ui_type] = frozenset(hintsets_intersection)\n    return ui_types_mapped_to_hintsets\n\n\ndef _safe_set_intersection(sets):\n    # set.intersection fails if it is not passed anything.\n    if len(sets) > 0:\n        return set.intersection(*sets)\n    else:\n        return set()\n\n\ndef get_ui_type_from_db_type(db_type_to_find):\n    for ui_type in UIType:\n        associated_db_types = ui_type.db_types\n        if db_type_to_find in associated_db_types:\n            return ui_type\n\n\ndef get_ui_type_from_id(ui_type_id):\n    try:\n        return UIType(ui_type_id)\n    except ValueError:\n        return None\n", "path": "mathesar/database/types.py"}], "after_files": [{"content": "\"\"\"\nThis file describes UI data types and how they map to DB-layer database types (subclasses\nof db.types.base.DatabaseType).\n\"\"\"\nfrom enum import Enum\nfrom collections.abc import Collection\nfrom db.types.base import (\n    DatabaseType, PostgresType, MathesarCustomType\n)\nfrom db.types.hintsets import db_types_hinted\n\n\nclass UIType(Enum):\n    id: str  # noqa: NT001\n    display_name: str  # noqa: NT001\n    db_types: Collection[DatabaseType]  # noqa: NT001\n\n    BOOLEAN = (\n        'boolean',\n        'Boolean',\n        {\n            PostgresType.BOOLEAN,\n        },\n    )\n    DATE = (\n        'date',\n        'Date',\n        {\n            PostgresType.DATE,\n        },\n    )\n    TIME = (\n        'time',\n        'Time',\n        {\n            PostgresType.TIME_WITH_TIME_ZONE,\n            PostgresType.TIME_WITHOUT_TIME_ZONE,\n        },\n    )\n    DATETIME = (\n        'datetime',\n        'Date & Time',\n        {\n            PostgresType.TIMESTAMP_WITH_TIME_ZONE,\n            PostgresType.TIMESTAMP_WITHOUT_TIME_ZONE,\n        },\n    )\n    DURATION = (\n        'duration',\n        'Duration',\n        {\n            PostgresType.INTERVAL,\n        },\n    )\n    EMAIL = (\n        'email',\n        'Email',\n        {\n            MathesarCustomType.EMAIL,\n        },\n    )\n    MONEY = (\n        'money',\n        'Money',\n        {\n            PostgresType.MONEY,\n            MathesarCustomType.MATHESAR_MONEY,\n            MathesarCustomType.MULTICURRENCY_MONEY,\n        }\n    )\n    NUMBER = (\n        'number',\n        'Number',\n        {\n            PostgresType.BIGINT,\n            PostgresType.DOUBLE_PRECISION,\n            PostgresType.INTEGER,\n            PostgresType.NUMERIC,\n            PostgresType.REAL,\n            PostgresType.SMALLINT,\n        }\n    )\n    TEXT = (\n        'text',\n        'Text',\n        {\n            PostgresType.CHARACTER,\n            PostgresType.CHARACTER_VARYING,\n            PostgresType.TEXT,\n            PostgresType.NAME,\n            PostgresType.CHAR,\n        },\n    )\n    URI = (\n        'uri',\n        'URI',\n        {\n            MathesarCustomType.URI,\n        }\n    )\n    JSON_ARRAY = (\n        'jsonlist',\n        'JSON List',\n        {\n            MathesarCustomType.MATHESAR_JSON_ARRAY,\n        }\n    )\n    JSON_OBJECT = (\n        'map',\n        'Map',\n        {\n            MathesarCustomType.MATHESAR_JSON_OBJECT,\n        }\n    )\n    ARRAY = (\n        'array',\n        'Array',\n        {\n            PostgresType._ARRAY,\n        }\n    )\n    # These are default Postgres types that we don't have specific behavior for yet in the UI.\n    OTHER = (\n        'other',\n        'Other',\n        {\n            PostgresType.BIT_VARYING,\n            PostgresType.BIT,\n            PostgresType.BYTEA,\n            PostgresType.CIDR,\n            PostgresType.DATERANGE,\n            PostgresType.HSTORE,\n            PostgresType.INET,\n            PostgresType.INT4RANGE,\n            PostgresType.INT8RANGE,\n            PostgresType.JSON,\n            PostgresType.JSONB,\n            PostgresType.MACADDR,\n            PostgresType.NUMRANGE,\n            PostgresType.OID,\n            PostgresType.REGCLASS,\n            PostgresType.TSRANGE,\n            PostgresType.TSTZRANGE,\n            PostgresType.TSVECTOR,\n            PostgresType.UUID,\n        },\n    )\n\n    def __new__(cls, ui_type_id, display_name, db_types):\n        \"\"\"\n        The Enum is adapted to take three initial properties. Enum's value is set to be the first\n        property -- the id.\n        \"\"\"\n        obj = object.__new__(cls)\n        obj._value_ = ui_type_id\n        obj.id = ui_type_id\n        obj.display_name = display_name\n        obj.db_types = frozenset(db_types)\n        return obj\n\n    def __str__(self):\n        return self.id\n\n\ndef ui_types_that_satisfy_hintset(ui_types_mapped_to_hintsets, hintset):\n    \"\"\"\n    Provided a mapping of UI types to their hintsets and a hintset, tries to find UI\n    types whose hintsets satisfy the passed hintset, meaning the UI types whose hintsets are\n    supersets of the passed hintset.\n    \"\"\"\n    hintset = set(hintset)\n    return frozenset(\n        ui_type\n        for ui_type, ui_type_hintset\n        in ui_types_mapped_to_hintsets.items()\n        if set.issubset(hintset, ui_type_hintset)\n    )\n\n\ndef get_ui_types_mapped_to_hintsets():\n    \"\"\"\n    Returns a dict where the keys are UI types and the values their hintsets.\n    A UI type's hintset is defined as the intersection of the hintsets of its associated\n    database types.\n    \"\"\"\n    ui_types_mapped_to_hintsets = {}\n    for ui_type in UIType:\n        associated_db_types = ui_type.db_types\n        associated_db_type_hintsets = tuple(\n            set(db_types_hinted[associated_db_type])\n            for associated_db_type in associated_db_types\n            if associated_db_type in db_types_hinted\n        )\n        hintsets_intersection = _safe_set_intersection(associated_db_type_hintsets)\n        ui_types_mapped_to_hintsets[ui_type] = frozenset(hintsets_intersection)\n    return ui_types_mapped_to_hintsets\n\n\ndef _safe_set_intersection(sets):\n    # set.intersection fails if it is not passed anything.\n    if len(sets) > 0:\n        return set.intersection(*sets)\n    else:\n        return set()\n\n\ndef get_ui_type_from_db_type(db_type_to_find):\n    for ui_type in UIType:\n        associated_db_types = ui_type.db_types\n        if db_type_to_find in associated_db_types:\n            return ui_type\n\n\ndef get_ui_type_from_id(ui_type_id):\n    try:\n        return UIType(ui_type_id)\n    except ValueError:\n        return None\n", "path": "mathesar/database/types.py"}]}