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

MIN(timestamp) returns wrong result for near-zero times

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 10.4, 10.5, 10.6
    • Fix Version/s: 10.4, 10.5
    • Component/s: Temporal Types
    • Labels:
      None

      Description

      For timestamps in (0,1) second interval (less than a second since the epoch) MIN returns zero.

      SET time_zone='+00:00';
       
      CREATE TABLE t1 (a TIMESTAMP(1));
      INSERT INTO t1 VALUES ('1970-01-01 00:00:00.1'),('1970-01-01 00:00:00.9');
       
      SELECT a FROM t1;
      SELECT MIN(a) FROM t1;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 c03841ec

      SELECT a FROM t1;
      a
      1970-01-01 00:00:00.1
      1970-01-01 00:00:00.9
      SELECT MIN(a) FROM t1;
      MIN(a)
      0000-00-00 00:00:00.0
      

      The problem was introduced in 10.4.1 by this commit:

      commit 34eb98387f8f46a80fb053081dbe20d415f23b39 (HEAD)
      Author: Alexander Barkov
      Date:   Sat Dec 8 19:39:23 2018 +0400
       
          MDEV-13995 MAX(timestamp) returns a wrong result near DST change
      

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: