﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
37090	Combined query targeted by In fails on Oracle if deeper combined queries are ordered	Jacob Walls	Sidharth Dusanapudi	"During [https://github.com/django/django/pull/21102/changes#r3204761827 review] of a related PR for #36938, we discovered another Oracle-only failure relating to clearing of unnecessary order_by inside unions.

We noticed `test_union_in_with_ordering` added in #33796 only accounts for one depth.

Failing test:
{{{#!py
    @skipUnlessDBFeature(""supports_slicing_ordering_in_compound"")
    def test_union_in_with_ordering_union(self):
        qs1 = Number.objects.filter(num__gt=7).order_by(""id"")
        qs2 = Number.objects.filter(num__lt=2).order_by(""-id"")
        qs3 = Number.objects.filter(num=5).order_by(""id"")
        union = qs1.union(qs2).order_by(""id"")
        self.assertNumbersEqual(
            Number.objects.exclude(
                id__in=union.union(qs3).order_by(""-id"").values(""id"")
            ),
            [2, 3, 4, 6, 7],
            ordered=False,
        )
}}}

{{{
django.db.utils.DatabaseError: ORA-00907: missing right parenthesis
Help: https://docs.oracle.com/error-help/db/ora-00907/
}}}

I'll extract the changes into a separate PR."	Bug	closed	Database layer (models, ORM)	dev	Normal	duplicate		Sidharth Dusanapudi	Unreviewed	1	0	0	0	0	0
