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

Delete missing rows with OR conditions

    XMLWordPrintable

Details

    • 10.2.2-3

    Description

      On mariaDB 10.0.25. I've got a problem when i delete some rows with a primary key VARCHAR + INT and a request with AND and OR conditions.

      mysql> select version();
      +--------------------------+
      | version()                |
      +--------------------------+
      | 10.0.25-MariaDB-0+deb8u1 |
      +--------------------------+
      1 row in set (0.00 sec)
      

       
      mysql> set autocommit=0;
      Query OK, 0 rows affected (0.00 sec)
       
      mysql> SHOW CREATE TABLE test;
      +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                                                                                                                 |
      +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | test  | CREATE TABLE `test` (
        `key1varchar` varchar(14) NOT NULL,
        `key2int` int(11) NOT NULL DEFAULT '0',
        PRIMARY KEY (`key1varchar`,`key2int`),
        KEY `key1varchar` (`key1varchar`),
        KEY `key2int` (`key2int`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
      +-------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      

      mysql> SELECT * FROM test;
      +-------------+---------+
      | key1varchar | key2int |
      +-------------+---------+
      | value1      |       0 |
      | value1      |       1 |
      | value1      | 1000685 |
      | value1      | 1003560 |
      | value1      | 1004807 |
      +-------------+---------+
      5 rows in set (0.00 sec)
      

      mysql> DELETE FROM test  
          -> WHERE 1 
          -> AND `key1varchar`='value1' 
          -> AND ( key2int <=1 OR  key2int > 1);
      Query OK, 1 row affected (0.00 sec)
      

      mysql> SELECT * FROM test;
      +-------------+---------+
      | key1varchar | key2int |
      +-------------+---------+
      | value1      |       1 |
      | value1      | 1000685 |
      | value1      | 1003560 |
      | value1      | 1004807 |
      +-------------+---------+
      4 rows in set (0.00 sec)
      

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              ebial@navista.fr ebial@navista.fr
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.