This can be found in file `django/db/backends/mysql/introspection.py`,
class attribute
`DatabaseIntrospection.data_types_reverse[FIELD_TYPE.SHORT]`.
Contrast this with the file `django/db/backends/mysql/creation.py`, class
attribute `DatabaseCreation.data_types['SmallIntegerField']`.
--
Ticket URL: <https://code.djangoproject.com/ticket/23357>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: introspection (added)
* needs_better_patch: => 0
* component: Uncategorized => Database layer (models, ORM)
* needs_tests: => 0
* easy: 0 => 1
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted
Comment:
Yes, and the same for `FIELD_TYPE.TINY`.
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:1>
* cc: introspection (removed)
* keywords: => introspection
Comment:
Is #22738 related?
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:2>
Comment (by claudep):
Replying to [comment:2 shaib]:
> Is #22738 related?
Not really, as MySQL returns the same `type_code=1` for both TINYINT and
BOOLEAN. However, I just noticed that we might differentiate boolean
fields on MySQL with internal_size/precision (4 for TINYINT and 1 for
BOOLEAN).
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:3>
Comment (by jdufresne):
I'd be happy to create and submit a patch that corrects the
`FIELD_TYPE.SHORT`, but I'm not sure what should be done about
`FIELD_TYPE.TINY` as that could theoretically represent either an `int`
(of limited size) or a `bool`.
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:4>
Comment (by jdufresne):
Pull request to handle `SHORT`:
<https://github.com/django/django/pull/3117>
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:5>
Comment (by jdufresne):
I updated the patch with the requested unit tests. I tested the unit tests
using MySQL and sqlite. I do not have other database backends readily
available to me.
Please let me know if there are any addition comments, suggestions, or
concerns. Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:6>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
* easy: 1 => 0
Comment:
This will require additional test adjustment and special casing for
Oracle. Left comments on the PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:7>
Comment (by jdufresne):
> This will require additional test adjustment and special casing for
Oracle. Left comments on the PR.
Thanks for the comments. I updated the patch based on the feedback.
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:8>
* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:9>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"f0d3dd4f04efa49e0b58da4847cb89770b59d4a8"]:
{{{
#!CommitTicketReference repository=""
revision="f0d3dd4f04efa49e0b58da4847cb89770b59d4a8"
Fixed #23357 -- Added small int introspection support to MySQL backend.
In the MySQL backend, updated the can_introspect_small_integer feature
flag to True. In data_types_reverse, map FIELD_TYPE.SHORT to a
SmallIntegerField. Added test to verify introspecting SmallIntegerFields
and fixed existing tests influenced by this change.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23357#comment:10>