diff options
Diffstat (limited to 'test/dialect/oracle/test_compiler.py')
-rw-r--r-- | test/dialect/oracle/test_compiler.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/dialect/oracle/test_compiler.py b/test/dialect/oracle/test_compiler.py index 2973c6e39..8981e74e8 100644 --- a/test/dialect/oracle/test_compiler.py +++ b/test/dialect/oracle/test_compiler.py @@ -9,6 +9,7 @@ from sqlalchemy import ForeignKey from sqlalchemy import func from sqlalchemy import Identity from sqlalchemy import Index +from sqlalchemy import insert from sqlalchemy import Integer from sqlalchemy import literal from sqlalchemy import literal_column @@ -42,6 +43,7 @@ from sqlalchemy.testing import fixtures from sqlalchemy.testing.assertions import eq_ignore_whitespace from sqlalchemy.testing.schema import Column from sqlalchemy.testing.schema import Table +from sqlalchemy.types import TypeEngine class CompileTest(fixtures.TestBase, AssertsCompiledSQL): @@ -1359,6 +1361,35 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL): "t1.c2, t1.c3 INTO :ret_0, :ret_1", ) + @testing.fixture + def column_expression_fixture(self): + class MyString(TypeEngine): + def column_expression(self, column): + return func.lower(column) + + return table( + "some_table", column("name", String), column("value", MyString) + ) + + @testing.combinations("columns", "table", argnames="use_columns") + def test_plain_returning_column_expression( + self, column_expression_fixture, use_columns + ): + """test #8770""" + table1 = column_expression_fixture + + if use_columns == "columns": + stmt = insert(table1).returning(table1) + else: + stmt = insert(table1).returning(table1.c.name, table1.c.value) + + self.assert_compile( + stmt, + "INSERT INTO some_table (name, value) VALUES (:name, :value) " + "RETURNING some_table.name, lower(some_table.value) " + "INTO :ret_0, :ret_1", + ) + def test_returning_insert_computed(self): m = MetaData() t1 = Table( |