#34639: MySQL 8.0 hangs indefinitely when using the admin search with a Foreign
Key
and Annotate
--------------------------------+------------------------------------------
Reporter: Nicolas Lupien | Owner: Simon Charette
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.2
Severity: Normal | Resolution:
Keywords: mysql | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------------
Changes (by Simon Charette):
* owner: nobody => Simon Charette
* status: new => assigned
Comment:
Hello Natalia,
In the case of (2), and as originally reported in #32433, calling
`delete()` after `distinct()` is only potentially ambiguous when `DISTINCT
ON` is used (`distinct(*fields)`) or when `DISTINCT` is against a subset
of fields that doesn't not include the primary key. That is the case
because if the subset of fields the distinct grouping is applied on
includes the primary key then it's not possible to reduce the set of
included rows to a subset (the primary key is distinct for each rows by
definition).
The `delete` method already prevents its usage after a `values()` call
([https://github.com/django/django/blob/42b4f81e6efd5c4587e1207a2ae3dd0facb1436f/django/db/models/query.py#L1140-L1141
source]) so doing `values(*subset_not_including_pk).distinct().delete()`
is not allowed. This only leaves the `distinct(*fields).delete()` case as
potentially problematic as reported in #32433.
[https://github.com/django/django/pull/13992/ The patch] for #32433 was
overly strict though and disallowed the `distinct().delete()` case which
then forced the logic introduced by
187118203197801c6cb72dc8b06b714b23b6dd3d to address #32682.
I'll work on PR to demonstrate what I mean by the above to make it crystal
clear.
--
Ticket URL: <https://code.djangoproject.com/ticket/34639#comment:11>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018922ce6e2f-9d5a8e3f-8324-4e51-91b5-331c1cb680bf-000000%40eu-central-1.amazonses.com.