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

Wrong result for CAST from TIME or DATETIME with zero integer part and non-zero microseconds to DECIMAL(X,Y)

    XMLWordPrintable

    Details

      Description

      SET sql_mode=''; -- Allow zero date
      SELECT
        CAST(TIMESTAMP'0000-00-00 00:00:00.123456' AS DECIMAL(10,6)) AS c1,
        CAST(TIME'00:00:00.123456' AS DECIMAL(10,6)) AS c2;
      

      +----------+----------+
      | c1       | c2       |
      +----------+----------+
      | 0.000000 | 0.000000 |
      +----------+----------+
      

      The expected result would be 0.123456 for both columns.

        Attachments

          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:
                Resolved: