Opened 8 years ago
Closed 8 years ago
#26680 closed Bug (duplicate)
more than one row returned by a subquery used as an expression
Reported by: | Maarten | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.9 |
Severity: | Normal | Keywords: | ORM subquery multiple rows |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Summary:
In 1.8.13 the subquery has a compare to "in", in 1.9.6 to "=". In my view 1.8 is correct.
The query:
leverancier_medew = Adresboek.objects.filter( klant_id=klant_id, soort='leverancier', leverancier=Leverancier.objects.filter( klant_id=klant_id, locatie=melding.apparaat.locatie))
gives in 1.8.13
SELECT "meldman_adresboek"."id", etc.etc. FROM "meldman_adresboek" WHERE ("meldman_adresboek"."soort" = 'leverancier' AND "meldman_adresboek"."klant_id" = 24 AND "meldman_adresboek"."leverancier_id" IN (SELECT U0."id" FROM "meldman_leverancier" U0 INNER JOIN "meldman_locatie_leverancier" U2 ON (U0."id" = U2."leverancier_id") WHERE (U0."klant_id" = 24 AND U2."locatie_id" = 75))) ORDER BY "meldman_adresboek"."achternaam" ASC, "meldman_adresboek"."voornaam" ASC
The line:
AND "meldman_adresboek"."leverancier_id" IN
changes in 1.9.6 to
AND "meldman_adresboek"."leverancier_id" =
which then returns the error: "more than one row returned by a subquery used as an expression".
My sincere thanks for your time and attention.
Greetings,
Maarten
Change History (2)
comment:1 by , 8 years ago
Description: | modified (diff) |
---|
comment:2 by , 8 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Type: | Uncategorized → Bug |
Note:
See TracTickets
for help on using tickets.
Duplicate of #25284 (this is documented as a backwards-incompatible change).