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

ALTER from DOUBLE to TIME returns a wrong result

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 10.4
    • Component/s: Temporal Types
    • Labels:
      None

      Description

      This script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a TIME);
      INSERT INTO t1 VALUES (0.999e19);
      SELECT * FROM t1;

      correctly returns:

      +-----------+
      | a         |
      +-----------+
      | 838:59:59 |
      +-----------+

      This script:

      DROP TABLE IF EXISTS t1,t2;
      CREATE TABLE t1 (a TIME);
      CREATE TABLE t2 (a DOUBLE);
      INSERT INTO t2 VALUES (0.999e19);
      INSERT INTO t1 SELECT a FROM t2;
      SELECT * FROM t1;

      also correctly returns:

      +-----------+
      | a         |
      +-----------+
      | 838:59:59 |
      +-----------+

      This script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DOUBLE);
      INSERT INTO t1 VALUES (0.999e19);
      ALTER TABLE t1 MODIFY a TIME;
      SELECT * FROM t1;

      erroneously returns

      +----------+
      | a        |
      +----------+
      | 00:00:00 |
      +----------+

      The expected result is 838:59:59, like in the previous two scripts.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: