1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #30412 -- Fixed crash when adding check constraints with OR'ed condition on Oracle and SQLite.

This commit is contained in:
can
2019-04-30 11:20:41 +03:00
committed by Mariusz Felisiak
parent 6866c91b63
commit 719b746620
4 changed files with 42 additions and 1 deletions

View File

@@ -23,6 +23,21 @@ class TestQuery(SimpleTestCase):
self.assertEqual(lookup.rhs, 2)
self.assertEqual(lookup.lhs.target, Author._meta.get_field('num'))
def test_simplecol_query(self):
query = Query(Author)
where = query.build_where(Q(num__gt=2, name__isnull=False) | Q(num__lt=F('id')))
name_isnull_lookup, num_gt_lookup = where.children[0].children
self.assertIsInstance(num_gt_lookup, GreaterThan)
self.assertIsInstance(num_gt_lookup.lhs, SimpleCol)
self.assertIsInstance(name_isnull_lookup, IsNull)
self.assertIsInstance(name_isnull_lookup.lhs, SimpleCol)
num_lt_lookup = where.children[1]
self.assertIsInstance(num_lt_lookup, LessThan)
self.assertIsInstance(num_lt_lookup.rhs, SimpleCol)
self.assertIsInstance(num_lt_lookup.lhs, SimpleCol)
def test_complex_query(self):
query = Query(Author)
where = query.build_where(Q(num__gt=2) | Q(num__lt=0))