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

An out-of-range datetime value (with a 5-digit year) can be created and cause troubles

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.5.25, 5.3.7
    • Fix Version/s: 5.5.27, 5.3.9
    • Component/s: None
    • Labels:
      None

      Description

      create table t1 (d datetime);
      # Query OK, 0 rows affected (0.22 sec)
      
      insert into t1 values ('9999-12-31 23:59:59');
      # Query OK, 1 row affected (0.00 sec)
      
      update t1 set d = addtime(d, '00:00:01');
      # Query OK, 1 row affected (0.00 sec)
      # Rows matched: 1  Changed: 1  Warnings: 0
      
      select * from t1 where d > '9999-12-31 23:59:59';
      # +---------------------+
      # | d                   |
      # +---------------------+
      # | :000-01-01 00:00:00 |
      # +---------------------+
      # 1 row in set (0.00 sec)
      

      This can potentially cause problems; for one, mysqldump/restore brings up a different value (all zeros).

      In MariaDB 5.2 it worked as expected – a warning 'Incorrect datetime value: '10000-01-01 00:00:00'' was produced on the update, and the value was set to NULL.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h