diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-13 14:53:29 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2017-09-13 14:53:29 -0400 |
commit | 01ed5c4009ce77876345107b3f8385caa93edf84 (patch) | |
tree | f99ccc94c33fd2cad0685d4cc4310f08f42a4e7a /lib/sqlalchemy/dialects/oracle/base.py | |
parent | 31f80b9eaeb3c3435b7f6679b41e434478b1d11c (diff) | |
download | sqlalchemy-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 'lib/sqlalchemy/dialects/oracle/base.py')
-rw-r--r-- | lib/sqlalchemy/dialects/oracle/base.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/sqlalchemy/dialects/oracle/base.py b/lib/sqlalchemy/dialects/oracle/base.py index b2eb44b5b..dbef1200a 100644 --- a/lib/sqlalchemy/dialects/oracle/base.py +++ b/lib/sqlalchemy/dialects/oracle/base.py @@ -733,12 +733,17 @@ class OracleCompiler(compiler.SQLCompiler): def visit_join(join): if join.isouter: + # https://docs.oracle.com/database/121/SQLRF/queries006.htm#SQLRF52354 + # "apply the outer join operator (+) to all columns of B in + # the join condition in the WHERE clause" - that is, + # unconditionally regardless of operator or the other side def visit_binary(binary): - if binary.operator == sql_operators.eq: - if join.right.is_derived_from(binary.left.table): - binary.left = _OuterJoinColumn(binary.left) - elif join.right.is_derived_from(binary.right.table): - binary.right = _OuterJoinColumn(binary.right) + if isinstance(binary.left, expression.ColumnClause) \ + and join.right.is_derived_from(binary.left.table): + binary.left = _OuterJoinColumn(binary.left) + elif isinstance(binary.right, expression.ColumnClause) \ + and join.right.is_derived_from(binary.right.table): + binary.right = _OuterJoinColumn(binary.right) clauses.append(visitors.cloned_traverse( join.onclause, {}, {'binary': visit_binary})) else: |