diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-30 20:42:35 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-30 20:42:35 -0400 |
commit | 754e7f52cf64b72988bdf8211c603809b32c16de (patch) | |
tree | e925e74538d9d387f20f8abb3a0771b6f5be59b6 /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | df99e1ef5f334ce7f4c8118c3e0bdf2949f54de3 (diff) | |
download | sqlalchemy-754e7f52cf64b72988bdf8211c603809b32c16de.tar.gz |
PostgreSQL enum with no elements returns NULL for the "label", skip this
Fixed bug where PostgreSQL dialect could not correctly reflect an ENUM
datatype that has no members, returning a list with ``None`` for the
``get_enums()`` call and raising a TypeError when reflecting a column which
has such a datatype. The inspection now returns an empty list.
Fixes: #4701
Change-Id: I202bab19728862cbc64deae211d5ba6a103b8317
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index f18bec932..1363e81af 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -3470,8 +3470,10 @@ class PGDialect(default.DefaultDialect): "name": enum["name"], "schema": enum["schema"], "visible": enum["visible"], - "labels": [enum["label"]], + "labels": [], } + if enum["label"] is not None: + enum_rec["labels"].append(enum["label"]) enums.append(enum_rec) return enums |