#33649: bulk_create() with ignore_conflicts=True and ForeignKey fails
-------------------------------------+-------------------------------------
     Reporter:  Markus Friedrich     |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  3.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  bulk_create          |             Triage Stage:
  ForeignKey ignore_conflicts        |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Markus Friedrich):

 >> Why? This error message is only raised when a related object **is not
 saved**.
 > The related object **is saved** since bulk_create() is called on it.
 This save is just not recognized by Django either because
 > - the used database does not support setting the pk by bulk_create (as
 documented) or
 > - bulk_create disables the setting of the pk if ignore_conflicts=True is
 used (as documented)
 > So the error is wrong in this case. And in my view at least for lower
 level functions like bulk_create (which are for performance tuning) no
 error should be raised if its unclear for Django if there is really an
 error. Its up to the caller to ensure that things are right, at least for
 lower level functions.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33649#comment:4>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701803d541048-9a048f44-354a-4c45-a4af-6849b1b27ae0-000000%40eu-central-1.amazonses.com.

Reply via email to