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

LP:737458 - Casting dates and times into integers works differently in 5.1-micro

    Details

    • Type: Bug
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Casting and comparing dates and times into or to integers does not work in 5.1-micro as it works in mysql-5.1. For a timestamp "YYYY-MM-DD HH:MM:SS" , mysql-5.1 produces an integer YYYYMMDDHHMMSS whereas 5.1-micro produces just YYYY

      test case

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (f1 TIME, f2 DATE, f3 DATETIME);
      INSERT INTO t1 VALUES ('11:22:33','2011-12-13','2011-12-13 11:22:33');
      SELECT CAST(f1 AS UNSIGNED), CAST(f2 AS UNSIGNED), CAST(f3 AS UNSIGNED) FROM t1;

      5.1-micro returns:

      --------------------------------------------------------------

      CAST(f1 AS UNSIGNED) CAST(f2 AS UNSIGNED) CAST(f3 AS UNSIGNED)

      --------------------------------------------------------------

      11 2011 2011

      --------------------------------------------------------------

      mysql-5.1 returns:

      --------------------------------------------------------------

      CAST(f1 AS UNSIGNED) CAST(f2 AS UNSIGNED) CAST(f3 AS UNSIGNED)

      --------------------------------------------------------------

      112233 20111213 20111213112233

      --------------------------------------------------------------

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 737458

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 737458

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                philipstoev Philip Stoev
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: