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

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2(EOL), 10.3(EOL)
    • 10.2.14, 10.3.6
    • Data types
    • None

    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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.