Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4857

Wrong result of HOUR('1 00:00:00')

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 10.0.3
    • 10.0.7
    • None
    • None

    Description

      HOUR() correctly returns hour>23 values in this script:

      CREATE TABLE t1 (a TIME);
      INSERT INTO t1 VALUES ('1 00:00:00');
      SELECT a, HOUR(a) FROM t1;
      +----------+---------+
      | a        | HOUR(a) |
      +----------+---------+
      | 24:00:00 |      24 |
      +----------+---------+

      and in this script:

      SELECT HOUR(MAKETIME(24,0,0));
      +------------------------+
      | HOUR(MAKETIME(24,0,0)) |
      +------------------------+
      |                     24 |
      +------------------------+

      However, it does not work well in some cases:

      SELECT HOUR('1 00:00:00'), HOUR(TIME('1 00:00:00'));
      +--------------------+--------------------------+
      | HOUR('1 00:00:00') | HOUR(TIME('1 00:00:00')) |
      +--------------------+--------------------------+
      |                  0 |                        0 |
      +--------------------+--------------------------+

      MySQL-5.5 exhibit the same behaviour.
      MySQL-5.6 correctly returns "24" for both expressions in the last query.

      So this bug should probably be fixed only in 10.0
      (while 5.3 and 5.5 should keep the original behaviour).

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.