--- /dev/null
+.. change::
+ :tags: bug, postgresql, regression
+ :tickets: 7590
+
+ Fixed regression where the change in :ticket:`7148` to repair ENUM handling
+ in PostgreSQL broke the use case of an empty ARRAY of ENUM, preventing rows
+ that contained an empty array from being handled correctly when fetching
+ results.
def _split_enum_values(array_string):
+
if '"' not in array_string:
# no escape char is present so it can just split on the comma
- return array_string.split(",")
+ return array_string.split(",") if array_string else []
# handles quoted strings from:
# r'abc,"quoted","also\\\\quoted", "quoted, comma", "esc \" quot", qpr'
t.drop(connection)
eq_(inspect(connection).get_enums(), [])
- def _type_combinations(exclude_json=False):
+ def _type_combinations(exclude_json=False, exclude_empty_lists=False):
def str_values(x):
return ["one", "two: %s" % x, "three", "four", "five"]
AnEnum.Foo,
]
+ def empty_list(x):
+ return []
+
class inet_str(str):
def __eq__(self, other):
return str(self) == str(other)
),
]
+ if not exclude_empty_lists:
+ elements.extend(
+ [
+ (postgresql.ENUM(AnEnum), empty_list),
+ (sqltypes.Enum(AnEnum, native_enum=True), empty_list),
+ (sqltypes.Enum(AnEnum, native_enum=False), empty_list),
+ (postgresql.ENUM(AnEnum, native_enum=True), empty_list),
+ ]
+ )
if not exclude_json:
elements.extend(
[
connection.scalar(select(table.c.bar).where(table.c.id == 2)),
)
- @_type_combinations()
+ @_type_combinations(exclude_empty_lists=True)
def test_type_specific_slice_update(
self, type_specific_fixture, connection, type_, gen
):
eq_(rows, [(gen(1),), (sliced_gen,)])
- @_type_combinations(exclude_json=True)
+ @_type_combinations(exclude_json=True, exclude_empty_lists=True)
def test_type_specific_value_delete(
self, type_specific_fixture, connection, type_, gen
):