#19102: Deletion using subqueries doesn't work for aggregates, extra or
select_related
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: master
layer (models, ORM) | Keywords:
Severity: Release | Has patch: 1
blocker | Needs tests: 0
Triage Stage: Accepted | Easy pickings: 0
Needs documentation: 0 |
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Aggregates, extra and select_related add columns to the subselect.
However, the subselect must contain only one column.
Example case (modified from #18676's example):
{{{
class OrgUnit(models.Model):
name = models.CharField(max_length=64, unique=True)
class Login(models.Model):
description = models.CharField(max_length=32)
orgunit = models.ForeignKey(OrgUnit)
Login.objects.extra(
select={'foo':'description'}
).annotate(
n=models.Count('description')
).filter(n=1).select_related('orgunit').delete()
}}}
The above fails with "too many columns in subquery" for various databases.
I have a work-in-progress patch for this at:
https://github.com/akaariai/django/commit/34a39ba8981638db2eb3fdb3d8d45393130a9d99
This is a regression caused by #18676, so marking as release blocker.
--
Ticket URL: <https://code.djangoproject.com/ticket/19102>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.