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

LP:1002546 - Wrong result from a query with an empty derived table

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5.28a, 5.3.10, 5.2.13
    • Component/s: None
    • Labels:

      Description

      The following test case gives us a wrong result in MariaDB 5.2/5.5

      CREATE TABLE t1 (
        pk int NOT NULL,
        col_int_nokey int NOT NULL,
        col_int_key int NOT NULL,
        col_time_key time NOT NULL,
        col_varchar_key varchar(1) NOT NULL,
        col_varchar_nokey varchar(1) NOT NULL,
        PRIMARY KEY (pk),
        KEY col_int_key (col_int_key),
        KEY col_time_key (col_time_key),
        KEY col_varchar_key (col_varchar_key,col_int_key)
      ) ENGINE=MyISAM;
      
      CREATE TABLE t2 (
        pk int NOT NULL AUTO_INCREMENT,
        col_int_nokey int NOT NULL,
        col_int_key int NOT NULL,
        col_time_key time NOT NULL,
        col_varchar_key varchar(1) NOT NULL,
        col_varchar_nokey varchar(1) NOT NULL,
        PRIMARY KEY (pk),
        KEY col_int_key (col_int_key),
        KEY col_time_key (col_time_key),
        KEY col_varchar_key (col_varchar_key,col_int_key)
      ) ENGINE=MyISAM;
      
      INSERT INTO t2 VALUES (1,4,4,'00:00:00','b','b');
      
      SET @var2:=4, @var3:=8;
      
      MariaDB [test]> SELECT * FROM ( SELECT @var3:=12, sq4_alias1.* FROM t1 AS sq4_alias1 WHERE (sq4_alias1.col_varchar_key + NULL) IS NULL OR       sq4_alias1.col_varchar_key = @var3 )  AS alias3;
      +-----------+----+---------------+-------------+--------------+-----------------+-------------------+
      | @var3:=12 | pk | col_int_nokey | col_int_key | col_time_key | col_varchar_key | col_varchar_nokey |
      +-----------+----+---------------+-------------+--------------+-----------------+-------------------+
      |        12 |  0 |             0 |           0 | 00:00:00     |                 |                   |
      +-----------+----+---------------+-------------+--------------+-----------------+-------------------+
      

      No rows are expected in the result here.

      (see also bug #13651000 from mysql-trunk)

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 1002546

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 1002546
            Hide
            sanja Oleksandr Byelkin added a comment -

            It is MySQL Bug#13651009 (last digit is nine)

            Show
            sanja Oleksandr Byelkin added a comment - It is MySQL Bug#13651009 (last digit is nine)
            Hide
            sanja Oleksandr Byelkin added a comment -

            MySQL patch looks OK.

            Show
            sanja Oleksandr Byelkin added a comment - MySQL patch looks OK.
            Hide
            sanja Oleksandr Byelkin added a comment -

            Mysql patch checked and history of previous changes. Commited. pushed.

            Show
            sanja Oleksandr Byelkin added a comment - Mysql patch checked and history of previous changes. Commited. pushed.
            Hide
            sanja Oleksandr Byelkin added a comment -

            checked by buildbot

            Show
            sanja Oleksandr Byelkin added a comment - checked by buildbot

              People

              • Assignee:
                sanja Oleksandr Byelkin
                Reporter:
                igor Igor Babaev
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: