If the default manager adds an annotation and sets use_for_related_fields, saves can fail.
|Reported by:||Ben Anhalt||Owned by:|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If a model has a custom manager that sets use_for_related_fields = True and overrides get_query_set() to return an annotated query set, then calling save() on instances of that model can fail with ProgrammingError: subquery has too many columns.
I am attaching a diff with a test illustrating this behavior.
Change History (5)
comment:1 Changed 7 years ago by
|Component:||Uncategorized → ORM aggregation|
|Patch needs improvement:||unset|