[patch] depth handling in fill_table_cache broken when using select_related(depth=1).extra()
|Reported by:||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Cc:||marcin@…, matthias@…, gabor@…||Triage Stage:||Accepted|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
As reported by marcin@… in #3275:
There is a bug in the way depth is handled in fill_table_cache, see the attached patch for a test case. When you specify a non-zero depth fill_table_cache goes one relationship too deep which causes get_cached_row not to handle all the columns from select_related.
This bug shows up when you use extra on that Query
Set: the extra fields to select should immediately follow columns handled by get_cached_row, but instead they get data from the relationship that fill_table_cache added and get_cached_row skipped.
I'm re-posting this bug (and his patches) here because #3275 is, essentially, an unrelated ticket; IMHO this here patch should go into mainline ASAP.
Change History (7)
comment:5 Changed 9 years ago by
|Keywords:||qs-rf-fixed added; qs-rf removed|
|Triage Stage:||Ready for checkin → Accepted|