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

Comparison result for column w/ YEAR(4) and const w/ 2 digits is incorrect

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.1.10
    • N/A
    • Temporal Types
    • None

    Description

      Description:
      Output:
      ===

      mysql> drop table t1; create table t1(a year(4));
      Query OK, 0 rows affected (0.00 sec)
       
      Query OK, 0 rows affected (0.01 sec)
       
      mysql> insert into t1 values (1930);
      Query OK, 1 row affected (0.00 sec)
       
      mysql> select a, a < 10 from t1;
      +------+--------+
      | a    | a < 10 |
      +------+--------+
      | 1930 |      1 |
      +------+--------+
      1 row in set (0.00 sec)
       
      mysql> select version();
      +---------------------+
      | version()           |
      +---------------------+
      | 10.1.10-MariaDB-log |
      +---------------------+
      1 row in set (0.00 sec)
      

      Problem:
      ===
      "a < 10" is not reasonable.
      It is expected to compare like ' a < 1910 '.

      How to repeat:

      drop table t1; create table t1(a year(4));
      insert into t1 values (1930);
      select a, a < 10 from t1;
      

      Suggested fix:
      "a < 10" returns 0.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dylan Dylan Su
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.