QuerySet.defer in default Manager breaks batch update (w/mysql?)
|Reported by:||bjj||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.1|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I have an object with a large, infrequently used textfield. I created a manager that defers that field since I do generate pages where I retrieve hundreds of those objects and I didn't want to spread defer() around everywhere.
This seems to break qs.update(). I have a ModelAdmin class that adds an option to globally set/unset a boolean. When I invoke it on the class with the modified manager I get mysql syntax error:
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM coverage_coverage U0 INNER JOIN coverage_run U1 ON (U0.run_id = U1.`i' at line 1")
Strangely this only happens if I first do a search from the admin interface and select from the search result. The code appears to simply do 'id in selected' so I'm not sure why the prior search would matter.
If this does not leap out as an 'aha' for someone I can try to distill a minimal case.
Change History (2)
comment:1 Changed 4 years ago by russellm
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to worksforme
- Status changed from new to closed