mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	[2.0.x] Fixed #28596 -- Fixed QuerySet.bulk_create() and cascade deletion crash on Oracle when using more than 65535 parameters.
Thanks Tim Graham for the review.
Backport of 1b823b8f18 from master
			
			
This commit is contained in:
		| @@ -9,3 +9,17 @@ class OperationsTests(unittest.TestCase): | ||||
|     def test_sequence_name_truncation(self): | ||||
|         seq_name = connection.ops._get_no_autofield_sequence_name('schema_authorwithevenlongee869') | ||||
|         self.assertEqual(seq_name, 'SCHEMA_AUTHORWITHEVENLOB0B8_SQ') | ||||
|  | ||||
|     def test_bulk_batch_size(self): | ||||
|         # Oracle restricts the number of parameters in a query. | ||||
|         objects = range(2**16) | ||||
|         self.assertEqual(connection.ops.bulk_batch_size([], objects), len(objects)) | ||||
|         # Each field is a parameter for each object. | ||||
|         self.assertEqual( | ||||
|             connection.ops.bulk_batch_size(['id'], objects), | ||||
|             connection.features.max_query_params, | ||||
|         ) | ||||
|         self.assertEqual( | ||||
|             connection.ops.bulk_batch_size(['id', 'other'], objects), | ||||
|             connection.features.max_query_params // 2, | ||||
|         ) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user