[Sqlalchemy-tickets] Issue #3807: table qualfification in PG on conflict (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: Michael B. <iss...@bi...> - 2016-09-28 22:00:52
|
New issue 3807: table qualfification in PG on conflict https://bitbucket.org/zzzeek/sqlalchemy/issues/3807/table-qualfification-in-pg-on-conflict Michael Bayer: ``` #!diff diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index 88110ba..7bc5c5c 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -1258,6 +1258,22 @@ class InsertOnConflictTest(fixtures.TestBase, AssertsCompiledSQL): "WHERE name != %(name_1)s " "AND description != %(description_2)s") + def test_do_update_add_whereclause_references_excluded(self): + i = insert( + self.table1, values=dict(name='foo')) + i = i.on_conflict_do_update( + constraint=self.excl_constr_anon, + set_=dict(name=i.excluded.name), + where=( + (self.table1.c.name != i.excluded.name)) + ) + self.assert_compile(i, + 'INSERT INTO mytable (name) VALUES ' + "(%(name)s) ON CONFLICT (name, description) " + "WHERE mytable.description != %(description_1)s " + 'DO UPDATE SET name = excluded.name ' + "WHERE mytable.name != excluded.name") + def test_quote_raw_string_col(self): t = table('t', column("FancyName"), column("other name")) ``` |