#29251: MySQL backend returns bytes instead of strings in some queries involving
database functions
-------------------------------------+-------------------------------------
Reporter: felixxm | Owner: felixxm
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: mysql bytes | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by felixxm):
Yes, but I didn't find any specific tickets. I checked that `mysql-
connector-python` behaves in the same way, then I noticed that MySQL
returns different data types in both cases, i.e.
- {{{SELECT LPAD(`test_xyz`.`column1`, CHAR_LENGTH(`test_xyz`.`column2`),
' ') AS `filled` FROM `test_xyz`;}}} returns `filled` as a `longtext`,
probably because it cannot predict a no. of chars,
- {{{SELECT LPAD(`test_xyz`.`column1`, 2, ' ') AS `filled` FROM
`test_xyz`;}}} returns `filled` as a `varchar(2)`.
I also found related discussion
https://github.com/django/django/pull/3754#discussion_r22146187 and
following comment "''...Looking briefly at the database driver, it appears
that longtext/BLOB is defined as returning bytes..."''.
--
Ticket URL: <https://code.djangoproject.com/ticket/29251#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.a861ad8a5cc178f4f9fc27be3f44d636%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.