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

NULLIF returns unexpected result with a YEAR field

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.1.2
    • Component/s: Temporal Types
    • Labels:
      None

      Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a YEAR(2));
      INSERT INTO t1 VALUES (0);
      SELECT a,NULLIF(a,2000),NULLIF(2001,a) FROM t1;
      

      returns

      +------+----------------+----------------+
      | a    | NULLIF(a,2000) | NULLIF(2001,a) |
      +------+----------------+----------------+
      |   00 |           NULL |              1 |
      +------+----------------+----------------+
      

      This is Ok that YEAR=00 is compared as equal to 2000, but the return value for NULLIF(2001,a) does not look Ok. The expected values is 2001, not 1.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              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: