diff options
author | Gord Thompson <gord@gordthompson.com> | 2021-03-06 12:19:13 -0700 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-03-06 22:27:59 -0500 |
commit | 506b88de5e428fd4ad2feff663ba53e2dbb28891 (patch) | |
tree | 4da8bb1166928480cec3dc9668d1a1a6175dd087 /lib/sqlalchemy/sql/elements.py | |
parent | 1f3ef9817453faa021544841d10b5b7107b57916 (diff) | |
download | sqlalchemy-506b88de5e428fd4ad2feff663ba53e2dbb28891.tar.gz |
Fix named CHECK constraint name omitted on repeated creates
Fixed issue where the CHECK constraint generated by :class:`_types.Boolean`
or :class:`_types.Enum` would fail to render the naming convention
correctly after the first compilation, due to an unintended change of state
within the name given to the constraint. This issue was first introduced in
0.9 in the fix for issue #3067, and the fix revises the approach taken at
that time which appears to have been more involved than what was needed.
Co-authored-by: Mike Bayer <mike_mp@zzzcomputing.com>
Fixes: #6007
Change-Id: I7ecff0a9d86191520f6841b3922a5af5a6971fba
Diffstat (limited to 'lib/sqlalchemy/sql/elements.py')
-rw-r--r-- | lib/sqlalchemy/sql/elements.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 85200bf25..b26918f2f 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -4979,33 +4979,8 @@ class conv(_truncated_label): __slots__ = () -class _defer_name(_truncated_label): - """mark a name as 'deferred' for the purposes of automated name - generation. - - """ - - __slots__ = () - - def __new__(cls, value): - if value is None: - return _NONE_NAME - elif isinstance(value, conv): - return value - else: - return super(_defer_name, cls).__new__(cls, value) - - def __reduce__(self): - return self.__class__, (util.text_type(self),) - - -class _defer_none_name(_defer_name): - """indicate a 'deferred' name that was ultimately the value None.""" - - __slots__ = () - - -_NONE_NAME = _defer_none_name("_unnamed_") +_NONE_NAME = util.symbol("NONE_NAME") +"""indicate a 'deferred' name that was ultimately the value None.""" # for backwards compatibility in case # someone is re-implementing the |