From 2cf83604c6ca0df3efa7033c865cbf2beb31cf71 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 25 Jan 2013 12:57:59 -0500 Subject: #2629 insert().returning() raises an informative CompileError if attempted to compile on a dialect that doesn't support RETURNING. --- test/sql/test_compiler.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/sql') diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py index e8fea2f7a..3b8aed23f 100644 --- a/test/sql/test_compiler.py +++ b/test/sql/test_compiler.py @@ -2553,6 +2553,14 @@ class CRUDTest(fixtures.TestBase, AssertsCompiledSQL): table.insert(inline=True), "INSERT INTO sometable (foo) VALUES (foobar())", params={}) + def test_insert_returning_not_in_default(self): + stmt = table1.insert().returning(table1.c.myid) + assert_raises_message( + exc.CompileError, + "RETURNING is not supported by this dialect's statement compiler.", + stmt.compile + ) + def test_empty_insert_default(self): stmt = table1.insert().values({}) # hide from 2to3 self.assert_compile(stmt, "INSERT INTO mytable () VALUES ()") -- cgit v1.2.1