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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    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

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

      Attachments

        Activity

          People

            serg Sergei Golubchik
            philipstoev Philip Stoev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.