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

The incorrect where condition result of the bit shift operation is performed on a negative double number column.

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5.16, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
    • 10.4, 10.5, 10.6
    • None

    Description

      In the Where condition of the query statement, a NOT IN multi-value calculation error occurs when the bit shift operation is performed on a negative double number column.

      For example,

      mysql> DROP TABLE IF EXISTS t0;
      Query OK, 0 rows affected (0.01 sec)
       
      mysql> CREATE TABLE `t0` (
          ->   `c0` double DEFAULT NULL
          -> );
      LECT c0 FROM t0 WHERE ((-1782140092 << 0)) NOT IN (c0,0);Query OK, 0 rows affected (0.00 sec)
       
      mysql> INSERT INTO t0 VALUES (-1782140092);
      Query OK, 1 row affected (0.00 sec)
       
      mysql> SELECT c0, (-1782140092 << 0) NOT IN (c0),(-1782140092 << 0) NOT IN (c0,0) FROM t0;
      +-------------+--------------------------------+----------------------------------+
      | c0          | (-1782140092 << 0) NOT IN (c0) | (-1782140092 << 0) NOT IN (c0,0) |
      +-------------+--------------------------------+----------------------------------+
      | -1782140092 |                              1 |                                1 |
      +-------------+--------------------------------+----------------------------------+
      1 row in set (0.00 sec)
       
      mysql> SELECT c0 FROM t0 WHERE ((-1782140092 << 0)) NOT IN (c0);
      +-------------+
      | c0          |
      +-------------+
      | -1782140092 |
      +-------------+
      1 row in set (0.00 sec)
       
      The expected results 
       
      mysql> SELECT c0 FROM t0 WHERE ((-1782140092 << 0)) NOT IN (c0,0);
      Empty set (0.00 sec)
      
      

      The number of records queried in the three query statements should be the same. However, the third query get the empty set.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            zzzzh Zeng
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.