From 927abc3b33f10464ed04db3d7a454faeb6e729f2 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 13 May 2022 16:08:34 -0400 Subject: render col name in on conflict set clause, not given key Fixed bug where the PostgreSQL :meth:`_postgresql.Insert.on_conflict` method and the SQLite :meth:`_sqlite.Insert.on_conflict` method would both fail to correctly accommodate a column with a separate ".key" when specifying the column using its key name in the dictionary passed to ``set_``, as well as if the :attr:`_sqlite.Insert.excluded` or :attr:`_postgresql.Insert.excluded` collection were used as the dictionary directly. Fixes: #8014 Change-Id: I67226aeedcb2c683e22405af64720cc1f990f274 --- lib/sqlalchemy/dialects/postgresql/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sqlalchemy/dialects/postgresql/base.py') diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 33563ac2c..c923f7014 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -2522,7 +2522,7 @@ class PGCompiler(compiler.SQLCompiler): value.type = c.type value_text = self.process(value.self_group(), use_schema=False) - key_text = self.preparer.quote(col_key) + key_text = self.preparer.quote(c.name) action_set_ops.append("%s = %s" % (key_text, value_text)) # check for names that don't match columns -- cgit v1.2.1