#34362 closed Bug (fixed)

FilteredRelation doesn’t support conditional expression

Reported by: zhu Owned by: Francesco Panico
Component: Database layer (models, ORM) Version: 4.1
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

    def test_conditional_expression(self):
        self.assertSequenceEqual(
            Author.objects.annotate(
                the_book=FilteredRelation(
                    "book",
                    condition=Q(
                        Value(False)
                        ),
                ),
            )
            .filter(
                the_book__isnull=False,
            ),
            [],
        )

Change History (16)

comment:1 by Mariusz Felisiak, 21 months ago

Component: UncategorizedDatabase layer (models, ORM)
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

comment:2 by Francesco Panico, 21 months ago

Owner: changed from nobody to Francesco Panico
Status: newassigned

comment:3 by Francesco Panico, 21 months ago

Has patch: set

comment:4 by Mariusz Felisiak, 21 months ago

Patch needs improvement: set

comment:5 by Francesco Panico, 21 months ago

Patch needs improvement: unset

comment:6 by David Wobrock, 21 months ago

Needs tests: set
Patch needs improvement: set

Adding Needs tests and Patch needs improvement after zhu's comment.

comment:7 by Francesco Panico, 20 months ago

Needs tests: unset
Patch needs improvement: unset

comment:8 by Mariusz Felisiak, 20 months ago

Needs tests: set
Patch needs improvement: set

comment:9 by Francesco Panico, 19 months ago

Needs tests: unset
Patch needs improvement: unset

comment:10 by Mariusz Felisiak, 19 months ago

Patch needs improvement: set

We should first fix #33766 so we don't end with an error prone solution.

comment:11 by Francesco Panico, 16 months ago

Patch needs improvement: unset

comment:12 by Mariusz Felisiak <felisiak.mariusz@…>, 16 months ago

In afc8805:

Refs #34362 -- Added get_child_with_renamed_prefix() hook.

comment:13 by Mariusz Felisiak, 16 months ago

Patch needs improvement: set

comment:14 by Francesco Panico, 15 months ago

Patch needs improvement: unset

comment:15 by Mariusz Felisiak, 15 months ago

Triage Stage: AcceptedReady for checkin

comment:16 by Mariusz Felisiak <felisiak.mariusz@…>, 15 months ago

Resolution: fixed
Status: assignedclosed

In 59f47547:

Fixed #34362 -- Fixed FilteredRelation() crash on conditional expressions.

Thanks zhu for the report and Simon Charette for reviews.

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