diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-12 12:57:40 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-12 12:58:23 -0400 |
commit | 70516536107a44230762206342c51239c5d85417 (patch) | |
tree | 9bc4a52fce9d27ed19fd5ea246072111f1d43e4c /lib | |
parent | 31f80b9eaeb3c3435b7f6679b41e434478b1d11c (diff) | |
download | sqlalchemy-ticket_4074.tar.gz |
use the stack to get the insert statement in on conflictticket_4074
Fixed bug in Postgresql :meth:`.postgresql.dml.Insert.on_conflict_do_update`
which would prevent the insert statement from being used as a CTE,
e.g. via :meth:`.Insert.cte`, within another statement.
Change-Id: Ie20972a05e194290bc9d92819750845872949ecc
Fixes: #4074
Diffstat (limited to 'lib')
-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 b56ac5b10..821752870 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1529,7 +1529,9 @@ class PGCompiler(compiler.SQLCompiler): set_parameters = dict(clause.update_values_to_set) # create a list of column assignment clauses as tuples - cols = self.statement.table.c + + insert_statement = self.stack[-1]['selectable'] + cols = insert_statement.table.c for c in cols: col_key = c.key if col_key in set_parameters: |