[Django] #34941: db_default with decimal.Decimal() doesn't return Decimal instances on Oracle.

12 views
Skip to first unread message

Django

unread,
Nov 2, 2023, 12:22:38 PM11/2/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz | Owner: nobody
Felisiak |
Type: Bug | Status: new
Component: Database | Version: 5.0
layer (models, ORM) |
Severity: Release | Keywords: oracle db_default
blocker |
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
While working on #34936 I noticed that `DecimalField` with `db_default`
set to a `Decimal()` instance doesn't return `Decimal()` on Oracle:

{{{
/runtests.py field_defaults
Testing against Django installed in '/django/django' with up to 8
processes
Found 16 test(s).
Creating test database for alias 'default'...
Creating test user...
System check identified no issues (0 silenced).
.....s..sF......
======================================================================
FAIL: test_field_db_defaults_returning (field_defaults.tests.DefaultTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/django/django/test/testcases.py", line 1427, in skip_wrapper
return test_func(*args, **kwargs)
File "/django/tests/field_defaults/tests.py", line 48, in
test_field_db_defaults_returning
self.assertEqual(a.cost, Decimal("3.33"))
AssertionError: 3.33 != Decimal('3.33')

----------------------------------------------------------------------
Ran 16 tests in 0.089s

FAILED (failures=1, skipped=2)
Destroying test database for alias 'default'...
Destroying test user...
Destroying test database tables...
}}}


Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.

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

Django

unread,
Nov 2, 2023, 12:26:07 PM11/2/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Mariusz Felisiak:

Old description:

> Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.

New description:

It works properly when using `bulk_create()`.

Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.

--

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

Django

unread,
Nov 2, 2023, 2:38:15 PM11/2/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | Triage Stage: Accepted

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

* stage: Unreviewed => Accepted


Comment:

Thanks!

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

Django

unread,
Nov 3, 2023, 12:29:16 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by GitHub <noreply@…>):

In [changeset:"7a09ba0962e0eaf4ad396475b392ba3234bf60ee" 7a09ba0]:
{{{
#!CommitTicketReference repository=""
revision="7a09ba0962e0eaf4ad396475b392ba3234bf60ee"
Refs #34941 -- Skipped
OperationTests.test_alter_field_change_nullable_to_decimal_database_default_not_null
on Oracle.
}}}

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

Django

unread,
Nov 3, 2023, 12:30:49 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | 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 <felisiak.mariusz@…>):

In [changeset:"e2330ccd102d4abe98b262d99e6f55458280df83" e2330ccd]:
{{{
#!CommitTicketReference repository=""
revision="e2330ccd102d4abe98b262d99e6f55458280df83"
[5.0.x] Refs #34941 -- Skipped
OperationTests.test_alter_field_change_nullable_to_decimal_database_default_not_null
on Oracle.

Backport of 7a09ba0962e0eaf4ad396475b392ba3234bf60ee from main
}}}

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

Django

unread,
Nov 3, 2023, 12:58:13 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Old description:

New description:

~~It works properly when using `bulk_create()`.~~

Regression in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.

--

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

Django

unread,
Nov 3, 2023, 4:36:27 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned

Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | 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):

* owner: nobody => Mariusz Felisiak
* status: new => assigned


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

Django

unread,
Nov 3, 2023, 4:49:45 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: assigned
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution:
Keywords: oracle db_default | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

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

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

Django

unread,
Nov 3, 2023, 11:28:14 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed

Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed

Keywords: oracle db_default | Triage Stage: Accepted
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:"656192c2c96bb955a399d92f381e38fe2254fe17" 656192c]:
{{{
#!CommitTicketReference repository=""
revision="656192c2c96bb955a399d92f381e38fe2254fe17"
Fixed #34941 -- Fixed fetching decimal db_defaults for DecimalFields on
Oracle.

This is a long standing bug in bc91f27a86090b4c688b56cd4e37f95eebe6e969
that began manifesting in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.
}}}

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

Django

unread,
Nov 3, 2023, 11:30:23 AM11/3/23
to django-...@googlegroups.com
#34941: db_default with decimal.Decimal() doesn't return Decimal instances on
Oracle.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Mariusz
| Felisiak
Type: Bug | Status: closed
Component: Database layer | Version: 5.0
(models, ORM) |
Severity: Release blocker | Resolution: fixed
Keywords: oracle db_default | 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:"1383dc75eb8171c43ef6a19cac3b9f57f549ccc4" 1383dc75]:
{{{
#!CommitTicketReference repository=""
revision="1383dc75eb8171c43ef6a19cac3b9f57f549ccc4"
[5.0.x] Fixed #34941 -- Fixed fetching decimal db_defaults for
DecimalFields on Oracle.

This is a long standing bug in bc91f27a86090b4c688b56cd4e37f95eebe6e969
that began manifesting in 7414704e88d73dafbcfbb85f9bc54cb6111439d3.

Backport of 656192c2c96bb955a399d92f381e38fe2254fe17 from main
}}}

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

Reply all
Reply to author
Forward
0 new messages