#30953: Model Inheritance and select_for_update with 'of'
-------------------------------------+-------------------------------------
     Reporter:  Abhijeet             |                    Owner:  Abhijeet
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  select_for_update    |             Triage Stage:  Accepted
  mti model inheritance              |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):

 * keywords:  race conditions, psql, concurrency, db => select_for_update
     mti model inheritance
 * version:  2.2 => master
 * stage:  Unreviewed => Accepted


Comment:

 > The generated SQL will only lock the table of A (the super-model) and
 not of B.

 I confirmed this is the case, `self` always use the parent model table
 instead of the current one.

 I'm not convinced we should make `select_for_update(of=('self',))` select
 '''all''' inherited tables though as that would prevents selecting only
 the current ''leaf'' model table. IMO the code should only be changed to
 make `self` point to the queryset's model table as documented.

 I suggest we also enhance the documentation to mention that parent links
 should be included in `of` when this is desired instead.

 In your case that would mean `of=('self', 'a_ptr')` to select both tables
 for update.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30953#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.80a55684a94002cd9437067f74dce5bc%40djangoproject.com.

Reply via email to