[Django] #28391: Cast doesn't take into account CharField's max_length on MySQL.

6 views
Skip to first unread message

Django

unread,
Jul 12, 2017, 2:45:34 PM7/12/17
to django-...@googlegroups.com
#28391: Cast doesn't take into account CharField's max_length on MySQL.
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords: Cast
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Correct behavior, e.g. (based on `db_functions/test_cast.py`):
{{{
>>> Author.objects.create(name='Bob', age=1111)
>>> numbers = Author.objects.annotate(cast_string=Cast('age',
models.CharField(max_length=3)))
>>> numbers.get().cast_string
111
}}}
on MySQL it returns `1111` (related with #28371).

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

Django

unread,
Jul 12, 2017, 3:21:58 PM7/12/17
to django-...@googlegroups.com
#28391: Cast doesn't take into account CharField's max_length on MySQL.
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Cast | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

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

* Attachment "28391.diff" added.

Django

unread,
Jul 12, 2017, 5:02:04 PM7/12/17
to django-...@googlegroups.com
#28391: Cast doesn't take into account CharField's max_length on MySQL.
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Cast | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

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

* stage: Unreviewed => Accepted


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

Django

unread,
Jul 13, 2017, 4:12:56 AM7/13/17
to django-...@googlegroups.com
#28391: Cast doesn't take into account CharField's max_length on MySQL.
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Cast | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

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

* has_patch: 0 => 1


Comment:

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

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

Django

unread,
Jul 17, 2017, 3:12:42 PM7/17/17
to django-...@googlegroups.com
#28391: Cast doesn't take into account CharField's max_length on MySQL.
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: closed

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

Keywords: Cast | 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:"776cee974933677730aef177eb5b5bdec3749c80" 776cee9]:
{{{
#!CommitTicketReference repository=""
revision="776cee974933677730aef177eb5b5bdec3749c80"
Fixed #28391 -- Fixed Cast() with CharField and max_length on MySQL.

Thanks Tim Graham for the review.
}}}

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

Reply all
Reply to author
Forward
0 new messages