Ah, I see. Thank you for explaining the thing and linking the code.
It looks more interesting now! I'm interested to start working on it.
I'll wait for approval from other people, too.

On Wednesday, June 8, 2022 at 2:17:32 PM UTC+2 j.bre...@netzkolchose.de 
wrote:

>
> > How can it be complicated ? I thought it's just something like 
> > getattr(MyModel, field_name) to get value and
> > model._meta.get_field(unique_field) to get the field instance..
> > Where can I find explanation for what you mean? and where can I find the 
> > PK code you're referring to?
>
> Field updates for multi-table models are internally split into multiple 
> tables updates, if the fields reside on several tables from the 
> inheritance chain. The identity of records is matched against pk values 
> stored in OneToOne xxx_ptr fields on the subtables. You can find the 
> construction logic for this in UpdateQuery.get_related_updates 
> (
> https://github.com/django/django/blob/49b470b9187b6be60e573fed08c8f4a87f133750/django/db/models/sql/subqueries.py#L124
> ).
>
> With using a different field for record identification without having 
> the pk (thus from degenerated model instances) this wont work anymore 
> (note it directly refers to pk__in selection). Most likely you will have 
> to do an explicit db roundtrip resolving "some_unique_field -> pk" 
> upfront to keep it working for multi-table spanning updates. Thats where 
> the impl might get complicated/messy.
>
>
> > Thank you. I was asked to re-open the ticket if there's an agreement to 
> > add the update..
> > Should I re-open it or we will need more than one person to agree on the 
> > update ?
> > (I'm sorry, this is my first contribution)
>
> You def. should get for more feedback, a single opinion does not mean 
> much here.
>
> Cheers, jerch
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/aa2081d9-90ea-4bd5-b51b-ad21468324b5n%40googlegroups.com.

Reply via email to