diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-30 09:22:00 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-06-30 09:23:02 -0400 |
commit | dee57477882f8876fd97071a790fe3d3ee2164c5 (patch) | |
tree | 7ad513edae9307cd4e3c8194ab7ee2899f30b9ac /lib/sqlalchemy | |
parent | 67edf8e376d4bf4baf5944b88dff1cb073e9ef72 (diff) | |
download | sqlalchemy-dee57477882f8876fd97071a790fe3d3ee2164c5.tar.gz |
apply quoting to "ON CONSTRAINT" symbol
Fixed issue in :meth:`_postgresql.Insert.on_conflict_do_nothing` and
:meth:`_postgresql.Insert.on_conflict_do_update` where the name of a unique
constraint passed as the ``constraint`` parameter would not be properly
quoted if it contained characters which required quoting.
Fixes: #6696
Change-Id: I4ffca9b8c72cef4ed39e2de96831ccc11a620422
Diffstat (limited to 'lib/sqlalchemy')
-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 4c7898132..4c654a643 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2322,7 +2322,9 @@ class PGCompiler(compiler.SQLCompiler): def _on_conflict_target(self, clause, **kw): if clause.constraint_target is not None: - target_text = "ON CONSTRAINT %s" % clause.constraint_target + target_text = "ON CONSTRAINT %s" % self.preparer.quote( + clause.constraint_target + ) elif clause.inferred_target_elements is not None: target_text = "(%s)" % ", ".join( ( |