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

TO_DAYS(DATE(TIME('32 00:00:00'))) returns a wrong result

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 5.3.12, 10.1, 10.2, 10.3, 10.4, 10.5
    • 10.4, 10.5
    • None
    • None

    Description

      mysql> select to_days('0000-01-01'), date(time('32 00:00:00')),to_days(date(time('32 00:00:00')));
      +-----------------------+---------------------------+------------------------------------+
      | to_days('0000-01-01') | date(time('32 00:00:00')) | to_days(date(time('32 00:00:00'))) |
      +-----------------------+---------------------------+------------------------------------+
      |                     1 | 0000-01-01                |                               NULL |
      +-----------------------+---------------------------+------------------------------------+
      1 row in set, 1 warning (0.00 sec)
       
      mysql> show warnings;
      +---------+------+---------------------------------------+
      | Level   | Code | Message                               |
      +---------+------+---------------------------------------+
      | Warning | 1292 | Incorrect datetime value: '768:00:00' |
      +---------+------+---------------------------------------+
      1 row in set (0.00 sec)

      The expected result for the third column is 1, without warnings.

      Or the other way around, date(time('32 00:00:00')) should return NULL.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:

              Git Integration

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