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

Inconsistent results for CAST(int,decimal,double AS DATETIME)

    XMLWordPrintable

Details

    Description

      For the query:

      SELECT CAST(010203101112 AS DATETIME(1)) AS c1,CAST(010203101112.3+0e0 AS DATETIME(1)) AS c2,CAST(010203101112.3+0e0 AS DATETIME(1)) AS c3;

      MySQL5.6 consistently returns values with YEAR=2001:

      +-----------------------+-----------------------+-----------------------+
      | c1                    | c2                    | c3                    |
      +-----------------------+-----------------------+-----------------------+
      | 2001-02-03 10:11:12.0 | 2001-02-03 10:11:12.3 | 2001-02-03 10:11:12.3 |
      +-----------------------+-----------------------+-----------------------+

      MariaDB returns either 2001 or 0001 in year:

      +-----------------------+-----------------------+-----------------------+
      | c1                    | c2                    | c3                    |
      +-----------------------+-----------------------+-----------------------+
      | 2001-02-03 10:11:12.0 | 0001-02-03 10:11:12.2 | 0001-02-03 10:11:12.2 |
      +-----------------------+-----------------------+-----------------------+

      MySQL-5.6 results look better.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.