Opened 17 years ago
Closed 17 years ago
#6018 closed (fixed)
[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: | dev |
Severity: | Keywords: | qs-rf-fixed | |
Cc: | marcin@…, matthias@…, gabor@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 QuerySet: 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.
Attachments (1)
Change History (7)
by , 17 years ago
Attachment: | select_related.diff added |
---|
comment:1 by , 17 years ago
Keywords: | qs-rf added |
---|
comment:2 by , 17 years ago
Cc: | added |
---|
the description is slightly incorrect, because this bug happens also when not using extra(),
for an example see #4789
comment:3 by , 17 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
Note: The patch in #4789 has a more extensive test case.
It also was already marked as ready before being prematurely closed as duplicate, which is why I am changing this ticket's state to "ready for check-in" now.
comment:4 by , 17 years ago
comment:5 by , 17 years ago
Keywords: | qs-rf-fixed added; qs-rf removed |
---|---|
Triage Stage: | Ready for checkin → Accepted |
comment:6 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [7477]) Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
One-character patch plus one-line testcase