From dda5c43cab88daad02bc871cf40bf4984e94a031 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 20 Jan 2022 15:01:47 -0500 Subject: restore empty list logic to ARRAY of ENUM parsing 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. Fixes: #7590 Change-Id: I43a35ef25281a6e0a26b698efebef6ba12a63e8c --- lib/sqlalchemy/dialects/postgresql/array.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/sqlalchemy/dialects/postgresql/array.py') diff --git a/lib/sqlalchemy/dialects/postgresql/array.py b/lib/sqlalchemy/dialects/postgresql/array.py index abe17ea35..74643c4d9 100644 --- a/lib/sqlalchemy/dialects/postgresql/array.py +++ b/lib/sqlalchemy/dialects/postgresql/array.py @@ -385,9 +385,10 @@ class ARRAY(sqltypes.ARRAY): 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' -- cgit v1.2.1