summaryrefslogtreecommitdiff
path: root/test/dialect/oracle/test_compiler.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-09-13 14:53:29 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-09-13 14:53:29 -0400
commit01ed5c4009ce77876345107b3f8385caa93edf84 (patch)
treef99ccc94c33fd2cad0685d4cc4310f08f42a4e7a /test/dialect/oracle/test_compiler.py
parent31f80b9eaeb3c3435b7f6679b41e434478b1d11c (diff)
downloadsqlalchemy-ticket_4076.tar.gz
Ensure (+) is rendered for all right-hand membersticket_4076
Fixed bug where Oracle 8 "non ansi" join mode would not add the ``(+)`` operator to expressions that used an operator other than the ``=`` operator. The ``(+)`` needs to be on all columns that are part of the right-hand side. Change-Id: I952e2369f11b78f5b918456ae3a5b0768d9761ec Fixes: #4076
Diffstat (limited to 'test/dialect/oracle/test_compiler.py')
-rw-r--r--test/dialect/oracle/test_compiler.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/dialect/oracle/test_compiler.py b/test/dialect/oracle/test_compiler.py
index 305359085..fc310f8f2 100644
--- a/test/dialect/oracle/test_compiler.py
+++ b/test/dialect/oracle/test_compiler.py
@@ -4,6 +4,7 @@
from sqlalchemy.testing import eq_
from sqlalchemy import types as sqltypes, exc, schema
from sqlalchemy.sql import table, column
+from sqlalchemy import and_
from sqlalchemy.testing import (fixtures,
AssertsExecutionResults,
AssertsCompiledSQL)
@@ -600,6 +601,54 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
'mytable.name) AS bar FROM mytable',
dialect=oracle.dialect(use_ansi=False))
+ def test_nonansi_plusses_everthing_in_the_condition(self):
+ table1 = table('mytable',
+ column('myid', Integer),
+ column('name', String),
+ column('description', String))
+
+ table2 = table(
+ 'myothertable',
+ column('otherid', Integer),
+ column('othername', String),
+ )
+
+ stmt = select([table1]).select_from(
+ table1.outerjoin(
+ table2,
+ and_(
+ table1.c.myid == table2.c.otherid,
+ table2.c.othername > 5,
+ table1.c.name == 'foo'
+ )
+ )
+ )
+ self.assert_compile(
+ stmt,
+ "SELECT mytable.myid, mytable.name, mytable.description "
+ "FROM mytable, myothertable WHERE mytable.myid = "
+ "myothertable.otherid(+) AND myothertable.othername(+) > "
+ ":othername_1 AND mytable.name = :name_1",
+ dialect=oracle.dialect(use_ansi=False))
+
+ stmt = select([table1]).select_from(
+ table1.outerjoin(
+ table2,
+ and_(
+ table1.c.myid == table2.c.otherid,
+ table2.c.othername == None,
+ table1.c.name == None
+ )
+ )
+ )
+ self.assert_compile(
+ stmt,
+ "SELECT mytable.myid, mytable.name, mytable.description "
+ "FROM mytable, myothertable WHERE mytable.myid = "
+ "myothertable.otherid(+) AND myothertable.othername(+) IS NULL "
+ "AND mytable.name IS NULL",
+ dialect=oracle.dialect(use_ansi=False))
+
def test_nonansi_nested_right_join(self):
a = table('a', column('a'))
b = table('b', column('b'))