summaryrefslogtreecommitdiff
path: root/tests/bulk_create
AgeCommit message (Collapse)Author
2025-11-06Fixed #36702 -- Made bulk_create() return pk values set by an expression.us77ipis
2025-10-24Fixed IntegrityError in bulk_create.tests.BulkCreateTransactionTests due to ↵Natalia
duplicate primary keys. Some tests in BulkCreateTransactionTests were inserting Country objects with hardcoded primary keys, which could conflict with existing rows (if the sequence value wasn't bumped by another test). Updated the tests to dynamically select an unused primary key instead. Thanks to Simon Charette for the exhaustive and enlightening review.
2025-08-21Fixed failing bulk_create test raising IntegrityError when run in reverse.Natalia
When running the `bulk_create` tests with Postgres settings and `--reverse`, the following IntegrityError was raised in bulk_create.tests.BulkCreateTransactionTests.test_objs_with_and_without_pk: django.db.utils.IntegrityError: duplicate key value violates unique constraint "bulk_create_country_pkey" DETAIL: Key (id)=(1) already exists. This branch fixes this by ensuring the ID is unique since DB sequences are not resetted between tests.
2025-08-15Avoided usage of DEBUG setting override in bulk_create tests.Simon Charette
Asserting an upper bound for the number of executed queries can be achieved by using CaptureQueriesContext instead of enabling the whole DEBUG machinery.
2025-08-15Fixed #36490 -- Avoided unnecessary transaction in bulk_create.Simon Charette
When dealing with an heterogeneous set of object with regards to primary key assignment that fits in a single batch there's no need to wrap the single INSERT statement in a transaction.
2025-05-08Refs #36143 -- Tested bulk_batch_size limit for bulk_update and bulk_create.Sage Abdullah
2025-04-05Refs #36088, Refs #36260 - Added supports_expression_defaults checks in ↵Tim Graham
bulk_create() tests.
2025-03-26Fixed #36260 -- Made bulk_create() work with DB-generated primary keys.Dmitry Shachnev
Co-authored-by: Simon Charette <charette.s@gmail.com>
2025-02-01Fixed #36088 -- Avoided unnecessary DEFAULT usage on bulk_create().Simon Charette
When all values of a field with a db_default are DatabaseDefault, which is the case most of the time, there is no point in specifying explicit DEFAULT for all INSERT VALUES as that's what the database will do anyway if not specified. In the case of PostgreSQL doing so can even be harmful as it prevents the usage of the UNNEST strategy and in the case of Oracle, which doesn't support the usage of the DEFAULT keyword, it unnecessarily requires providing literal db defaults. Thanks Lily Foote for the review.
2023-07-10Fixed #34698 -- Made QuerySet.bulk_create() retrieve primary keys when ↵Thomas Chaumeny
updating conflicts.
2023-05-11Fixed #34558 -- Fixed QuerySet.bulk_create() crash with Now() on Oracle.Mariusz Felisiak
2022-11-22Fixed #34171 -- Fixed QuerySet.bulk_create() on fields with db_column in ↵DevilsAutumn
unique_fields/update_fields. Bug in 0f6946495a8ec955b471ca1baaf408ceb53d4796. Thanks Joshua Brooks for the report.
2022-11-22Fixed #34177 -- Fixed QuerySet.bulk_create() crash on "pk" in unique_fields.Mariusz Felisiak
Bug in 0f6946495a8ec955b471ca1baaf408ceb53d4796.
2022-10-08Refs #33990 -- Renamed TransactionTestCase.assertQuerysetEqual() to ↵Gregor Gärtner
assertQuerySetEqual(). Co-Authored-By: Michael Howitz <mh@gocept.com>
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-02-03Refs #33476 -- Refactored problematic code before reformatting by Black.Mariusz Felisiak
In these cases Black produces unexpected results, e.g. def make_random_password( self, length=10, allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789', ): or cursor.execute(""" SELECT ... """, [table name], )
2022-01-19Fixed #31685 -- Added support for updating conflicts to QuerySet.bulk_create().sean_c_hsu
Thanks Florian Apolloner, Chris Jerdonek, Hannes Ljungberg, Nick Pope, and Mariusz Felisiak for reviews.
2021-07-15Refs #32508 -- Raised Type/ValueError instead of using "assert" in ↵Daniyal
django.db.models. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-01-14Refs #31369 -- Removed models.NullBooleanField per deprecation timeline.Mariusz Felisiak
2020-10-26Fixed #29497 -- Fixed loss of assigned parent when saving child with ↵Hannes Ljungberg
bulk_create() after parent.
2020-07-20Fixed #17653 -- Allowed using zero as AutoFields value on MySQL if ↵Mariusz Felisiak
NO_AUTO_VALUE_ON_ZERO SQL mode is enabled.
2020-02-28Fixed #31301 -- Fixed crash of QuerySet.bulk_create() with mixed empty and ↵Hans Aarne Liblik
set ForeignKeys to AutoFields on Oracle.
2020-02-10Fixed #31003 -- Doc'd and tested return value of QuerySet.bulk_create().Adam Johnson
2019-11-19Fixed #30987 -- Added models.PositiveBigIntegerField.Caio Ariede
2019-10-21Fixed #30827 -- Made batch_size arg of QuerySet.bulk_create() respect ↵Ahmet Kucuk
DatabaseOperations.bulk_batch_size(). Thanks Chetan Khanna for tests.
2019-10-01Fixed #30510 -- Fixed crash of QuerySet.bulk_create() with mixed-length ↵Ahmet Kucuk
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.
2019-01-30Refs #29444 -- Renamed DatabaseFeatures.can_return_id* to be generic for ↵Johannes Hoppe
other columns.
2018-12-22Renamed Sqlite and Sqlite3 references to SQLite.Nick Pope
2018-08-03Fixed #28668 -- Allowed QuerySet.bulk_create() to ignore insert conflicts.Tom
2018-04-27Fixed #29367 -- Fixed model state on objects with a primary key created with ↵Oscar Esgalha
QuerySet.bulk_create().
2018-03-20Fixed #29227 -- Allowed BooleanField to be null=True.Tim Graham
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
2018-01-12Removed unused query log clearing in bulk_create tests.Tim Graham
2017-07-29Used assertRaisesMessage() to test Django's error messages.Mads Jensen
2017-02-24Refs #22144 -- Added test for QuerySet.bulk_create() with long non-ASCII text.Mariusz Felisiak
2017-02-13Refs #22669 -- Fixed bulk_create test if Pillow isn't installed.Vytis Banaitis
2017-02-09Fixed #22669 -- Fixed QuerySet.bulk_create() with empty model fields on Oracle.Mikhail Nacharov
2017-01-25Removed unused variables that are overwritten.Mads Jensen
2017-01-18Refs #23919 -- Removed encoding preambles and future importsClaude Paroz
2016-10-25Fixed #27385 -- Fixed QuerySet.bulk_create() on PostgreSQL when the number ↵David Barragán Merino
of objects is a multiple plus one of batch_size.
2016-08-06Fixed #27026 -- Fixed state initialization of bulk_create() objects if ↵Sjoerd Job Postmus
can_return_ids_from_bulk_insert.
2016-03-02Refs #19527 -- Allowed QuerySet.bulk_create() to set the primary key of its ↵acrefoot
objects. PostgreSQL support only. Thanks Vladislav Manchev and alesasnouski for working on the patch.
2015-12-03Fixed many spelling mistakes in code, comments, and docs.Josh Soref
2015-10-09Fixed #22705 -- Fixed QuerySet.bulk_create() on models without any fields on ↵Tim Graham
Oracle. Fixed on other backends by 134ca4d438bd7cbe8f0f287a00d545f96fa04a01. Thanks Mariusz Felisiak for the solution.
2015-09-22Fixed #24509 -- Added Expression support to SQLInsertCompilerAlex Hill
2015-07-02Fixed #24997 -- Enabled bulk_create() on proxy modelsWilliam Schwartz
2015-02-06Sorted imports with isort; refs #23860.Tim Graham
2014-11-03Fixed #23620 -- Used more specific assertions in the Django test suite.Berker Peksag
2014-06-07Fixed #3711, #6734, #12581 -- Bounded connection.queries.Aymeric Augustin
Prevented unlimited memory consumption when running background tasks with DEBUG=True. Thanks Rob, Alex, Baptiste, and others.
2014-02-06Fixed #17713 -- Renamed BaseDatabaseFeatures.allows_primary_key_0 to ↵Vajrasky Kok
allows_auto_pk_0. MySQL does allow primary key with value 0. It only forbids autoincrement primary key with value 0. Thanks Claude Paroz for the report.
2013-12-23Imported override_settings from its new location.Aymeric Augustin