diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-03-30 14:48:41 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-03-30 14:49:46 -0400 |
commit | ab61d66dee9b3c3639907557852908858daacb6f (patch) | |
tree | 1c884eb2d0372372bc9146f42bedddb4cacdccde /lib/sqlalchemy/dialects/postgresql/base.py | |
parent | 57aac308cea2bdb5b1a15f05bf8ad479f66611d9 (diff) | |
download | sqlalchemy-ab61d66dee9b3c3639907557852908858daacb6f.tar.gz |
Refine domain nullable rules for PostgreSQL reflection
Fixed issue in PostgreSQL reflection where a column expressing "NOT NULL"
will supersede the nullability of a corresponding domain.
Fixes #6161
Change-Id: I1a3de49afcdb952f71bd7a7cc7b264513c93eff5
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 6e6f5513d..ba7774590 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -3767,8 +3767,9 @@ class PGDialect(default.DefaultDialect): attype, is_array = _handle_array_type(attype) # strip quotes from case sensitive enum or domain names enum_or_domain_key = tuple(util.quoted_token_parser(attype)) - # A table can't override whether the domain is nullable. - nullable = domain["nullable"] + # A table can't override a not null on the domain, + # but can override nullable + nullable = nullable and domain["nullable"] if domain["default"] and not default: # It can, however, override the default # value, but can't set it to null. |