summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-01-25 12:57:59 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-01-25 12:57:59 -0500
commit2cf83604c6ca0df3efa7033c865cbf2beb31cf71 (patch)
tree84609eda76a2be6eea232ba794c7d12ca0bb20df /test/sql
parenta477f8a61ec60b2fc343d87aa30ef6595c77727d (diff)
downloadsqlalchemy-2cf83604c6ca0df3efa7033c865cbf2beb31cf71.tar.gz
#2629
insert().returning() raises an informative CompileError if attempted to compile on a dialect that doesn't support RETURNING.
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_compiler.py8
1 files changed, 8 insertions, 0 deletions
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 ()")