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

Inserting a huge time value into a datetime column produces a wrong result.

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Cannot Reproduce
    • 5.3.12, 5.5.34, 10.0.6
    • N/A
    • N/A
    • None

    Description

      mysql> create table t1 (a datetime);
      Query OK, 0 rows affected (0.07 sec)
       
      mysql> insert into t1 values (time('800:20:30'));
      Query OK, 1 row affected (0.03 sec)
       
      mysql> select * from t1;
      +---------------------+
      | a                   |
      +---------------------+
      | 0000-00-08 00:20:30 |
      +---------------------+
      1 row in set (0.00 sec)

      The above result looks wrong.

      Explicit conversion from time to datetime seems to return a much better result:

      mysql> select cast(time('800:20:30') as datetime);
      +-------------------------------------+
      | cast(time('800:20:30') as datetime) |
      +-------------------------------------+
      | 0000-01-02 08:20:30                 |
      +-------------------------------------+
      1 row in set (0.00 sec)

      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.