#35350: Crash on write of new instance when using GeneratedField
-------------------------------------+-------------------------------------
     Reporter:  Matt Hegarty         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  GeneratedField       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 This is similar to #35019 (fixed by
 03af8fbd0f1cfc08edadda248cf5d3498e8ed2f7) but when dealing with instances
 that have a primary key assigned and `force_insert` is not specified.

 When this is the case `Mode.save`
 
[https://github.com/django/django/blob/4636baec179d8733e92c1eccfa669bd72d739735/django/db/models/base.py#L1094-L1112
 will first attempt to perform an] `UPDATE` as it cannot know whether or
 not the row exists.

 It seems that the `non_pk` logic in `_save_table` needs to be adapted to
 also needs to exclude deferred fields.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35350#comment:2>
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/0107018ea4fa5893-73fd03ff-1c56-46e9-8e5d-0cbecce88166-000000%40eu-central-1.amazonses.com.

Reply via email to