Code

Opened 2 years ago

Closed 2 years ago

Last modified 9 months ago

#17174 closed New feature (fixed)

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

Reported by: jammon Owned by: 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 poirier 2 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 2 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 2 years ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from new to assigned

comment:3 Changed 2 years ago by aaugustin

  • Owner changed from aaugustin to nobody
  • Status changed from assigned to new
  • Triage Stage changed from Unreviewed to Accepted

comment:4 Changed 2 years ago by poirier

  • Owner changed from nobody to poirier
  • Status changed from new to assigned

Changed 2 years ago by poirier

comment:5 Changed 2 years ago by poirier

  • Easy pickings set
  • Has patch set

comment:6 Changed 2 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from assigned to closed

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 9 months 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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.