Menu

#4257 (ok 4.1.7) Hide fractional seconds when applicable

4.1.6
fixed
None
1
2014-02-09
2014-01-28
No

Also see bug 4190.

Fractional seconds should be hidden if the table definition did not specify that they should be stored. Specifically, N digits should be shown (and be editable in the timepicker) where N is the number for that field in the definition.

But in MySQL before 5.6.4, fractional seconds are not even supported for most data types. phpMyAdmin however still displays .000000 after every value, for e.g. TIMESTAMPs.

Please note that the default, when omiting N in the definition, is 0 in MySQL (since 5.6.4), whereas the default is 6 in standard SQL.

So for backwards compatibility, they should really be hidden. People that didn't update their MySQL are suddenly seeing all those zeros, while they can't even be stored (in their current definition) anyway.

Discussion

  • Marc Delisle

    Marc Delisle - 2014-01-28
    • assigned_to: Marc Delisle
     
  • Marc Delisle

    Marc Delisle - 2014-01-28
    • assigned_to: Marc Delisle --> nobody
     
  • Viduranga Wijesooriya

    I will fix this

     
  • Viduranga Wijesooriya

    Please check https://github.com/phpmyadmin/phpmyadmin/pull/882. If it's not backward compatible please tell me why and give your opinions

     
  • Joris Debonnet

    Joris Debonnet - 2014-01-29

    Just tried it, and that change does fix the issue! Certainly good enough to ensure backwards compatibility.

     
  • Madhura Jayaratne

    If I understand correctly the earlier versions of MySQL simply ignores the fractional seconds part[1]. So i guess the problem is more or less related to the confusion it creates.

    [1] http://dev.mysql.com/doc/refman/5.0/en/fractional-seconds.html

     
  • Joris Debonnet

    Joris Debonnet - 2014-01-29

    Exactly, the confusion was the problem. With this fix, you can still do everything you could do before (calculations, or even store the data if supported in recent versions), but it won't create the confusion anymore for people that are not using it (i.e. old datatypes without the fractional seconds).

     
  • Marc Delisle

    Marc Delisle - 2014-01-29

    IMO the fix is incomplete; see my comments in the pull request.

     
  • Viduranga Wijesooriya

    Marc,
    Yes I only saw that issue now. I only checked my fix with 'time' type. But popup box appears with 'datetime' and 'timestamp'. So have to fix their appearance too. We need to check mysql version for that. I will try to fix it too. Thank you for the feedback

     
  • Marc Delisle

    Marc Delisle - 2014-01-29

    From Joris Debonnet in github comments:
    I don't understand why the MySQL version needs to be checked. This issue completely and only depends on the definition of the table field: if it has a positive number (such as TIME(6), TIMESTAMP(6), DATETIME(6)), then the microseconds should be shown. If there is no number (or it is 0), they should not be shown. That's all there is to it! :)

    MySQL versions that do not support it will not have a number. For MySQL versions that do support it, but where you see 0, there should still be no microsecond mentions anywhere in the interface. So the MySQL version does not (directly) make any difference, it's all in the field definition.

    Further: to be really awesome, if possible, it should actually display only N digits since you can also define TIME(3) etc. That's mostly for the tabular displaying; not so much the popup, I'm sure all-or-nothing is fine there.

     
  • Marc Delisle

    Marc Delisle - 2014-01-31
    • assigned_to: Marc Delisle
     
  • Marc Delisle

    Marc Delisle - 2014-01-31
    • summary: Hide fractional seconds --> Hide fractional seconds when applicable
     
  • Marc Delisle

    Marc Delisle - 2014-01-31
    • summary: Hide fractional seconds when applicable --> (ok 4.1.7) Hide fractional seconds when applicable
    • status: open --> resolved
    • Priority: 2 --> 1
     
  • Marc Delisle

    Marc Delisle - 2014-02-09
    • Status: resolved --> fixed