#25298: Forbid QuerySet filtering by a related field that expects a single value
when multiple values are returned
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: Y3K
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: 1.8
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Naddiseo):
For reference, here's some sql fiddles:
` select * from Child where rel_id = (select id from Parent where cnt=?);
`
||= Engine =|| SubQuery Rows || Result || Link ||
||= MySQL =|| 0 || No error, 0 records || http://sqlfiddle.com/#!9/1d497/1
||
||= MySQL =|| 1 || No error, 1 record || http://sqlfiddle.com/#!9/1d497/2
||
||= MySQL =|| 2 || Error || http://sqlfiddle.com/#!9/1d497/3 ||
||= PostgreSQL =|| 0 || No error, 0 records ||
http://sqlfiddle.com/#!15/1d497/3 ||
||= PostgreSQL =|| 1 || No error, 1 record ||
http://sqlfiddle.com/#!15/1d497/2 ||
||= PostgreSQL =|| 2 || Error || http://sqlfiddle.com/#!15/1d497/1 ||
||= SQLite =|| 0 || No error, 0 records ||
http://sqlfiddle.com/#!7/1d497/3 ||
||= SQLite =|| 1 || No error, 1 record || http://sqlfiddle.com/#!7/1d497/2
||
||= SQLite =|| 2 || **No error, 2 records** ||
http://sqlfiddle.com/#!7/1d497/1 ||
--
Ticket URL: <https://code.djangoproject.com/ticket/25298#comment:4>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.895415c3773496059271ed0a3cb70b5c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.