Changes between Initial Version and Version 1 of Ticket #33649, comment 4


Ignore:
Timestamp:
Apr 18, 2022, 1:20:00 PM (2 years ago)
Author:
Mariusz Felisiak

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33649, comment 4

    initial v1  
    1 >> Why? This error message is only raised when a related object **is not saved**.
    2 > The related object **is saved** since bulk_create() is called on it. This save is just not recognized by Django either because
    3 > - the used database does not support setting the pk by bulk_create (as documented) or
    4 > - bulk_create disables the setting of the pk if ignore_conflicts=True is used (as documented)
    5 > 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.
     1> Why? This error message is only raised when a related object **is not saved**.
     2
     3The related object **is saved** since bulk_create() is called on it. This save is just not recognized by Django either because
     4 - the used database does not support setting the pk by bulk_create (as documented) or
     5 - bulk_create disables the setting of the pk if ignore_conflicts=True is used (as documented)
     6So 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.
Back to Top