Hello.
I just wanted to know, whether I run into a bug, and whether I should report it.
Normally select_for_update and select_related try to lock all affected rows in all tables. One can specify "of" for select_for_update to limit tables to lock (to prevent locking nullable relations).
Recently a bug was fixed, which allowed to lock parent nodes with multitable inheritance. But what about proxies? For me the following does not work. Should it?
class Parent(Model):
foreign = ForeignKey(Foreign, null=True, blank=True)
class Child(Parent):
class Meta:
proxy = True
class Foreign(Model):
pass
with transaction.atomic():
Child.objects.select_for_update(of=('self',)).select_related('foreign').get(pk=1)
So the (pseudo) code above fails with a message "FOR UPDATE cannot be applied to the nullable side of an outer join"
So is this expected behaviour or a bug? What are possible workarounds for that?