[Django] #34362: FilteredRelation doesn’t support conditional expression

43 views
Skip to first unread message

Django

unread,
Feb 22, 2023, 1:02:38 AM2/22/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-----------------------------------------+------------------------
Reporter: zhu | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 4.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
{{{
def test_conditional_expression(self):
self.assertSequenceEqual(
Author.objects.annotate(
the_book=FilteredRelation(
"book",
condition=Q(
Value(False)
),
),
)
.filter(
the_book__isnull=False,
),
[],
)

}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34362>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 22, 2023, 3:02:50 AM2/22/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* type: Uncategorized => Bug
* component: Uncategorized => Database layer (models, ORM)
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:1>

Django

unread,
Feb 22, 2023, 5:10:34 PM2/22/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned

Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* owner: nobody => Francesco Panico
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:2>

Django

unread,
Mar 4, 2023, 1:04:22 PM3/4/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/16620 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:3>

Django

unread,
Mar 4, 2023, 2:26:11 PM3/4/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:4>

Django

unread,
Mar 4, 2023, 5:01:39 PM3/4/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* needs_better_patch: 1 => 0


Comment:

[https://github.com/django/django/pull/16622 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:5>

Django

unread,
Mar 6, 2023, 9:31:01 AM3/6/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by David Wobrock):

* needs_better_patch: 0 => 1

* needs_tests: 0 => 1


Comment:

Adding ''Needs tests'' and ''Patch needs improvement'' after
[https://github.com/django/django/pull/16622#issuecomment-1455677532 zhu's
comment].

--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:6>

Django

unread,
Mar 12, 2023, 9:18:39 AM3/12/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* needs_better_patch: 1 => 0

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:7>

Django

unread,
Mar 16, 2023, 4:51:36 AM3/16/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:8>

Django

unread,
Apr 17, 2023, 6:30:56 PM4/17/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:9>

Django

unread,
Apr 20, 2023, 4:35:48 AM4/20/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:10>

Django

unread,
Jul 19, 2023, 5:47:11 PM7/19/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:11>

Django

unread,
Jul 21, 2023, 4:26:09 AM7/21/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"afc880571d5f5a16b977070b15014f9583524898" afc8805]:
{{{
#!CommitTicketReference repository=""
revision="afc880571d5f5a16b977070b15014f9583524898"
Refs #34362 -- Added get_child_with_renamed_prefix() hook.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:12>

Django

unread,
Jul 24, 2023, 7:22:49 AM7/24/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:13>

Django

unread,
Aug 9, 2023, 4:46:18 AM8/9/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Francesco Panico):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:14>

Django

unread,
Aug 11, 2023, 6:35:25 AM8/11/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: assigned
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:15>

Django

unread,
Aug 11, 2023, 7:19:19 AM8/11/23
to django-...@googlegroups.com
#34362: FilteredRelation doesn’t support conditional expression
-------------------------------------+-------------------------------------
Reporter: zhu | Owner: Francesco
| Panico
Type: Bug | Status: closed

Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"59f475470494ce5b8cbff816b1e5dafcbd10a3a3" 59f47547]:
{{{
#!CommitTicketReference repository=""
revision="59f475470494ce5b8cbff816b1e5dafcbd10a3a3"
Fixed #34362 -- Fixed FilteredRelation() crash on conditional expressions.

Thanks zhu for the report and Simon Charette for reviews.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34362#comment:16>

Reply all
Reply to author
Forward
0 new messages