#27982: Possible race condition related to queryset union
-------------------------------------+-------------------------------------
Reporter: gigelu | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by gigelu):
Yes, it's totally reproducible without DRF.
The view:
{{{
def bug_test(request):
qs1 = SimpleNotification.objects.only(
'type', 'popup_type', 'completed', 'date_created')
qs2 = DecisionNotification.objects.only(
'type', 'popup_type', 'completed', 'date_created')
qs = qs1.union(qs2).order_by('-date_created')
paginator = Paginator(qs, 20)
page = request.GET.get('page')
try:
objects = paginator.page(page)
except (PageNotAnInteger, EmptyPage):
objects = paginator.page(1)
return render(request, 'bug/index.html', {'result': len(objects)})
}}}
Results:
http://i.imgur.com/XzcW5p4.png
http://i.imgur.com/Girk0pO.png
With a breakpoint inside paginator's init I get the correct results,
without it I get only one notification.
--
Ticket URL: <https://code.djangoproject.com/ticket/27982#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/064.4637c24e8a4073ae5debe9f953fc9007%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.