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

Microseconds: Precision is ignored in CURRENT_TIMESTAMP(N) when it is given as a default column value

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 10.0.0, 5.5.25, 5.3.7
    • Fix Version/s: 10.0.1, 5.5.29, 5.3.10
    • Component/s: None
    • Labels:
      None

      Description

      CREATE TABLE t (a TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(0));
      # Query OK, 0 rows affected (0.20 sec)
      
      INSERT INTO t VALUES (NULL);
      # Query OK, 1 row affected (0.04 sec)
      
      SELECT * FROM t;
      # +-------------------------+
      # | a                       |
      # +-------------------------+
      # | 2012-08-07 04:18:48.353 |
      # +-------------------------+
      # 1 row in set (0.00 sec)
      

      Inserting CURRENT_TIMESTAMP(0) explicitly works as expected:

      INSERT INTO t VALUES (CURRENT_TIMESTAMP(0));
      # Query OK, 1 row affected (0.04 sec)
      
      SELECT * FROM t;
      # +-------------------------+
      # | a                       |
      # +-------------------------+
      # | 2012-08-07 04:18:48.353 |
      # | 2012-08-07 04:23:51.000 |
      # +-------------------------+
      # 2 rows in set (0.01 sec)
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            serg Sergei Golubchik added a comment -

            in MySQL it's fixed differently. one might specify a precision, but the precision must match the column's precision. Let's do the same, for compatibility reasons.

            Show
            serg Sergei Golubchik added a comment - in MySQL it's fixed differently. one might specify a precision, but the precision must match the column's precision. Let's do the same, for compatibility reasons.
            Hide
            serg Sergei Golubchik added a comment -

            pushed a 10.0 specific fix into 10.0-base

            Show
            serg Sergei Golubchik added a comment - pushed a 10.0 specific fix into 10.0-base

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 1 week, 7 hours, 20 minutes
                  1w 7h 20m