summaryrefslogtreecommitdiff
path: root/tests/bulk_create
diff options
context:
space:
mode:
authorAhmet Kucuk <ahmetkucuk92@gmail.com>2019-10-01 01:42:48 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-01 12:38:58 +0200
commitdc890bef5ad8e9fccce55f3e64af72103ea6e8c1 (patch)
tree176fbb572488e543934b0da6eb5b6a40f0627826 /tests/bulk_create
parente1c1eaf0c6f4d3d2f60513d20aa9b84b17d096ec (diff)
downloaddjango-dc890bef5ad8e9fccce55f3e64af72103ea6e8c1.tar.gz
Fixed #30510 -- Fixed crash of QuerySet.bulk_create() with mixed-length texts on Oracle.
Text with more than 4000 characters must be set to as a CLOB on Oracle what caused a mixed datatype error (ORA-01790) when shorter text appeared in the same operation.
Diffstat (limited to 'tests/bulk_create')
-rw-r--r--tests/bulk_create/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py
index 08c753a826..47aa7afcdc 100644
--- a/tests/bulk_create/tests.py
+++ b/tests/bulk_create/tests.py
@@ -49,6 +49,16 @@ class BulkCreateTests(TestCase):
Country.objects.bulk_create([Country(description='Ж' * 3000)])
self.assertEqual(Country.objects.count(), 1)
+ @skipUnlessDBFeature('has_bulk_insert')
+ def test_long_and_short_text(self):
+ Country.objects.bulk_create([
+ Country(description='a' * 4001),
+ Country(description='a'),
+ Country(description='Ж' * 2001),
+ Country(description='Ж'),
+ ])
+ self.assertEqual(Country.objects.count(), 4)
+
def test_multi_table_inheritance_unsupported(self):
expected_message = "Can't bulk create a multi-table inherited model"
with self.assertRaisesMessage(ValueError, expected_message):