Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 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: UI/UX:

Description

Hi,

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.

Briefly:
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.

Cheers,
Simon

Attachments (1)

bug_orm_q_filters.tgz (4.4 KB) - added by djcoin 3 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 3 years ago by djcoin

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

comment:1 Changed 3 years ago by mlavin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Duplicate of #12252 or is this not fixed?

comment:2 Changed 3 years ago by anonymous

  • Resolution set to duplicate
  • Status changed from new to closed

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 3 years ago by kmtracey

(Previous update was me.)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.