diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py index 7fa8561c95..d749173d51 100644 --- a/django/db/backends/base/features.py +++ b/django/db/backends/base/features.py @@ -57,7 +57,6 @@ class BaseDatabaseFeatures(object): # Is there a REAL datatype in addition to floats/doubles? has_real_datatype = False supports_subqueries_in_group_by = True - supports_bitwise_or = True # Is there a true datatype for uuid? has_native_uuid_field = False diff --git a/django/db/backends/oracle/features.py b/django/db/backends/oracle/features.py index 83c1bb3cdf..e2840e0fe8 100644 --- a/django/db/backends/oracle/features.py +++ b/django/db/backends/oracle/features.py @@ -14,7 +14,6 @@ class DatabaseFeatures(BaseDatabaseFeatures): supports_subqueries_in_group_by = False supports_transactions = True supports_timezones = False - supports_bitwise_or = False has_native_duration_field = True can_defer_constraint_checks = True supports_partially_nullable_unique_constraints = False diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 58b83d88dc..b800339809 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -442,7 +442,8 @@ WHEN (new.%(col_name)s IS NULL) elif connector == '&': return 'BITAND(%s)' % ','.join(sub_expressions) elif connector == '|': - raise NotImplementedError("Bit-wise or is not supported in Oracle.") + lhs, rhs = sub_expressions + return 'BITAND(-%(lhs)s-1,%(rhs)s)+%(lhs)s' % {'lhs': lhs, 'rhs': rhs} elif connector == '^': return 'POWER(%s)' % ','.join(sub_expressions) return super(DatabaseOperations, self).combine_expression(connector, sub_expressions) diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index c6daa504b1..120bf81d1a 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -741,7 +741,6 @@ class ExpressionOperatorTests(TestCase): self.assertEqual(Number.objects.get(pk=self.n.pk).integer, 40) self.assertEqual(Number.objects.get(pk=self.n.pk).float, Approximate(15.500, places=3)) - @skipUnlessDBFeature('supports_bitwise_or') def test_lefthand_bitwise_or(self): # LH Bitwise or on integers Number.objects.filter(pk=self.n.pk).update(integer=F('integer').bitor(48))