diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 8 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 8 |
2 files changed, 15 insertions, 1 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index f626391dec..8781c4cdd4 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1794,13 +1794,19 @@ This has a number of caveats though: ``post_save`` signals will not be sent. * It does not work with child models in a multi-table inheritance scenario. * If the model's primary key is an :class:`~django.db.models.AutoField` it - does not retrieve and set the primary key attribute, as ``save()`` does. + does not retrieve and set the primary key attribute, as ``save()`` does, + unless the database backend supports it (currently PostgreSQL). * It does not work with many-to-many relationships. .. versionchanged:: 1.9 Support for using ``bulk_create()`` with proxy models was added. +.. versionchanged:: 1.0 + + Support for setting primary keys on objects created using ``bulk_create()`` + when using PostgreSQL was added. + The ``batch_size`` parameter controls how many objects are created in single query. The default is to create all objects in one batch, except for SQLite where the default is such that at most 999 variables per query are used. diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index 29700f4393..6df47d1f82 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -203,6 +203,11 @@ Database backends * Temporal data subtraction was unified on all backends. +* If the database supports it, backends can set + ``DatabaseFeatures.can_return_ids_from_bulk_insert=True`` and implement + ``DatabaseOperations.fetch_returned_insert_ids()`` to set primary keys + on objects created using ``QuerySet.bulk_create()``. + Email ~~~~~ @@ -315,6 +320,9 @@ Models * The :func:`~django.db.models.prefetch_related_objects` function is now a public API. +* :meth:`QuerySet.bulk_create() <django.db.models.query.QuerySet.bulk_create>` + sets the primary key on objects when using PostgreSQL. + Requests and Responses ~~~~~~~~~~~~~~~~~~~~~~ |
