Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#17174 closed New feature (fixed)

The docs should mention, that MySql doesn't support microseconds

Reported by: jammon Owned by: Dan Poirier
Component: Documentation Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

MySQL doesn't store the microsecond part of a TimeField or DateTimeField, which is accounted for in the code (in django/db/backends/mysql/base.py). But the documentation doesn't mention this limitation.

Suggestion: Add this sentence to /en/dev/ref/databases -> MySQL Notes -> Notes on specific fields -> DateTime fields:

MySQL does not support storing the microsecond part of a TimeField or DateTimeField,
so the microsecond part of the data is truncated (set to zero).

(It cost me quite some time to find out, why the integration tests failed on the staging server. I couldn't believe, that MySQL has such a limitation. See the bug report from Feb 2005 (!) http://bugs.mysql.com/bug.php?id=8523).

Attachments (1)

17174.diff (596 bytes) - added by Dan Poirier 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 5 years ago by jammon

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Maybe we should add even more sharply, that the precision is truncated to seconds. (There are no milliseconds either.)

comment:2 Changed 5 years ago by Aymeric Augustin

Owner: changed from nobody to Aymeric Augustin
Status: newassigned

comment:3 Changed 5 years ago by Aymeric Augustin

Owner: changed from Aymeric Augustin to nobody
Status: assignednew
Triage Stage: UnreviewedAccepted

comment:4 Changed 5 years ago by Dan Poirier

Owner: changed from nobody to Dan Poirier
Status: newassigned

Changed 5 years ago by Dan Poirier

Attachment: 17174.diff added

comment:5 Changed 5 years ago by Dan Poirier

Easy pickings: set
Has patch: set

comment:6 Changed 5 years ago by Karen Tracey

Resolution: fixed
Status: assignedclosed

In [17095]:

Fix #17174: Add note in the supported databases notes that MySQL can't conceive of a time unit smaller than a second. Thanks jammon and poirier.

comment:7 Changed 3 years ago by sarang (@…

MySQL does support microseconds now (starting with version 5.6.4). Follow this ticket for more details: https://code.djangoproject.com/ticket/19716

Note: See TracTickets for help on using tickets.
Back to Top