#28668: Add ON CONFLICT support to QuerySet.bulk_create()
-------------------------------------+-------------------------------------
     Reporter:  Tom Forbes           |                    Owner:  Tom
                                     |  Forbes
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Дилян Палаузов):

 Add documentation what bulk_create() is supposed to return.

 I assume this not going to work, as Postgresql has
 can_return_ids_from_bulk_insert, but 'INSERT ON CONFLICT DO NOTHING
 RETURNING id' returns only the ids of the inserted rows, so the assert
 will fail.  In particular not inserted rows are not returned.
 {{{
 -                ids = self._batched_insert(objs_without_pk, fields,
 batch_size)
 +                ids = self._batched_insert(objs_without_pk, fields,
 batch_size, on_conflict=on_conflict)
                  if connection.features.can_return_ids_from_bulk_insert:
                      assert len(ids) == len(objs_without_pk)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28668#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/061.092a76e2f2d7d438c39328227fd6d6fb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to