diff options
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r-- | test/dialect/postgresql/test_compiler.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index 98b974ea5..2221fd30a 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -2321,6 +2321,28 @@ class InsertOnConflictTest(fixtures.TestBase, AssertsCompiledSQL): ): meth() + def test_on_conflict_cte_plus_textual(self): + """test #7798""" + + bar = table("bar", column("id"), column("attr"), column("foo_id")) + s1 = text("SELECT bar.id, bar.attr FROM bar").columns( + bar.c.id, bar.c.attr + ) + s2 = ( + insert(bar) + .from_select(list(s1.selected_columns), s1) + .on_conflict_do_update( + index_elements=[s1.selected_columns.id], + set_={"attr": s1.selected_columns.attr}, + ) + ) + + self.assert_compile( + s2, + "INSERT INTO bar (id, attr) SELECT bar.id, bar.attr " + "FROM bar ON CONFLICT (id) DO UPDATE SET attr = bar.attr", + ) + def test_do_nothing_no_target(self): i = ( |