Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#15834 closed Bug (duplicate)

Django ORM transforming inner join to outer joins depending on Q() ordering

Reported by: djcoin Owned by: nobody
Component: Uncategorized Version: 1.2
Severity: Normal Keywords: orm, outer join, inner join, join, Q, filter
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



I don't have the time yet to completely isolate the bug/reproducing steps, yet im almost sure there is a bug related to this.
You may see sql log files attached as changes are performed to my code an thus query hit the postgres database.

I created a more or less complex queryset.

I have to Q filter to apply to it: say Q1 and Q2.
Filtering by the one or the other not at the same time yields results.

But when both are combined with an or, Q1 | Q2, results changes.
In one case I do not have any result in the other I have.
Printing postgres log, it seems that in one case, some joins are made inner (no results then) in the other case, outer joins are made.

Summary: difference between the two below request (inner join to outer join):
queryset = queryset.filter(event_descr_filter | op_filter)
queryset = queryset.filter(op_filter | event_descr_filter)

See all the files attached.
You wont be able to reproduce the bug, but it may gives you clues.


Attachments (1)

bug_orm_q_filters.tgz (4.4 KB) - added by djcoin 8 years ago.
Include cleaned up but not working src files, log of postgres, details of Q filter leading to the bug.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by djcoin

Attachment: bug_orm_q_filters.tgz added

Include cleaned up but not working src files, log of postgres, details of Q filter leading to the bug.

comment:1 Changed 8 years ago by Mark Lavin

Duplicate of #12252 or is this not fixed?

comment:2 Changed 8 years ago by anonymous

Resolution: duplicate
Status: newclosed

This does sound exactly like #12252, and since the version is set to 1.2 I'm going to assume it is #12252. djcoin, can you try on 1.3, where the fix for #12252 is available? If you still see the problem with 1.3 then please reopen this.

comment:3 Changed 8 years ago by Karen Tracey

(Previous update was me.)

Note: See TracTickets for help on using tickets.
Back to Top