[Django] #33464: Django db expressions doesn't combine MOD

5 views
Skip to first unread message

Django

unread,
Jan 27, 2022, 11:10:03 AM1/27/22
to django-...@googlegroups.com
#33464: Django db expressions doesn't combine MOD
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
gsinghkular |
Type: | Status: new
Uncategorized |
Component: Database | Version: 3.2
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When writing a Django expression for a query that does MOD, if the types
of the query are different (Decimal and Integer), it doesn't resolve the
result to a Decimal type, like it does for other mathematical operators.

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

Django

unread,
Jan 27, 2022, 11:18:18 AM1/27/22
to django-...@googlegroups.com
#33464: Django db expressions doesn't combine MOD
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

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

* status: new => closed
* type: Uncategorized => Cleanup/optimization
* resolution: => duplicate


Comment:

Duplicate of #33397.

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

Django

unread,
Mar 31, 2022, 3:38:31 AM3/31/22
to django-...@googlegroups.com
#33464: Django db expressions doesn't combine MOD
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: nobody
Type: | Status: new

Cleanup/optimization |
Component: Database layer | Version: 3.2
(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
-------------------------------------+-------------------------------------
Changes (by Luke Plant):

* status: closed => new
* resolution: duplicate =>


Comment:

I'm pretty sure the changes committed as part of #33397, while closely
related, doesn't actually address this case. I think it's best to handle
this as a separate ticket.

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

Django

unread,
Mar 31, 2022, 4:50:17 AM3/31/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.

-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 3.2
(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):

* stage: Unreviewed => Accepted


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

Django

unread,
Aug 24, 2022, 3:48:27 PM8/24/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 3.2
(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 David Wobrock):

* cc: David Wobrock (added)


Comment:

Hasn't this been addressed by
https://github.com/django/django/pull/15271/files#diff-
359ab56295cce36b9597e1d65185f695f271955617b40f43df58ce3fe76fd0c8R492?
Removing the marked line will make
`expressions.tests.ExpressionOperatorTests.test_lefthand_modulo_null` fail
with a `Cannot infer type of '%%' expression involving these types:
IntegerField, IntegerField. You must set output_field.`

Which sounds pretty close to what is described in the issue here.
Or what am I missing? :)

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

Django

unread,
Aug 25, 2022, 12:26:25 AM8/25/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 3.2
(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
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak):

Replying to [comment:4 David Wobrock]:


> Hasn't this been addressed by
https://github.com/django/django/pull/15271/files#diff-
359ab56295cce36b9597e1d65185f695f271955617b40f43df58ce3fe76fd0c8R492?

No, this issue is for mixed numeric types, e.g. `DecimalField` and
`IntegerField`.

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

Django

unread,
Sep 21, 2022, 2:50:30 PM9/21/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: David
Type: | Wobrock
Cleanup/optimization | Status: assigned

Component: Database layer | Version: 3.2
(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 David Wobrock):

* owner: nobody => David Wobrock
* status: new => assigned
* has_patch: 0 => 1


Comment:

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

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

Django

unread,
Sep 27, 2022, 12:08:53 AM9/27/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: David
Type: | Wobrock
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 3.2
(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/33464#comment:7>

Django

unread,
Sep 27, 2022, 2:40:47 PM9/27/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: David
Type: | Wobrock
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 3.2
(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):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin


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

Django

unread,
Sep 27, 2022, 2:41:57 PM9/27/22
to django-...@googlegroups.com
#33464: Resolve output_field when combining numeric expressions with MOD operator.
-------------------------------------+-------------------------------------
Reporter: gsinghkular | Owner: David
Type: | Wobrock
Cleanup/optimization | Status: closed

Component: Database layer | Version: 3.2
(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 GitHub <noreply@…>):

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


Comment:

In [changeset:"cff1f888e997522666835f96833840f52a13d322" cff1f88]:
{{{
#!CommitTicketReference repository=""
revision="cff1f888e997522666835f96833840f52a13d322"
Fixed #33464 -- Resolved output_field for combined numeric expressions
with MOD operator.
}}}

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

Reply all
Reply to author
Forward
0 new messages