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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.12, 5.5.36, 10.0.10
    • Fix Version/s: 5.5.38, 10.0.12, 5.3.13
    • Component/s: None
    • Labels:

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              bar Alexander Barkov added a comment -

              Pushed into 5.3 and 5.5

              Show
              bar Alexander Barkov added a comment - Pushed into 5.3 and 5.5

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: