mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[2.2.x] Fixed #30412 -- Fixed crash when adding check constraints with OR'ed condition on Oracle and SQLite.
Backport of 719b746620 from master
			
			
This commit is contained in:
		| @@ -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)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user