Skip to content

"select * from a left join b on a.col1=b.col1 where b.col1 is null" can't filter out expect line #717

@irene-coming

Description

@irene-coming
  • dble version:
    5.6.29-dble-9.9.9.9-287a2f4-20180921052651

  • preconditions :
    prepare a separate mysql database for compare with dble

  • configs:

schema.xml

<table name="table_a" primaryKey="id" rule="hash-four" dataNode="dn1,dn2,dn3,dn4"></table>
<table name="table_b" primaryKey="id" rule="hash-four" dataNode="dn1,dn2,dn3,dn4"></table>
<table name="table_c" primaryKey="id" rule="hash-four" dataNode="dn1,dn2,dn3,dn4"></table>
  • steps:
    step1. create table and insert data in both dble and compare mysql server :
create table table_a(id int, name varchar(20));
create table table_b(id int, name varchar(20));
insert into table_a value(1,'a');
insert into table_b values(1,'d'),(2,'b'),(3,'c');

step2. execute query with compare mysql server:

mysql> select b.* from table_b b left join table_a a on a.id=b.id where a.id is NULL;
+------+------+
| id   | name |
+------+------+
|    3 | c    |
|    2 | b    |
+------+------+
2 rows in set (0.00 sec)

step3. execute query with dble business port:

mysql> select b.* from table_b b left join table_a a on a.id=b.id where a.id is NULL;
Empty set (0.02 sec)
  • expect result:
    1. step3(dble's resultset) get the same result with step2(mysql's resultset)
  • real result:
    1.step3 get different result with step2
  • supplements:
    1.

If there is no matching row for the right table in the ON or USING part in a LEFT JOIN, a row with all columns set to NULL is used for the right table. You can use this fact to find rows in a table that have no counterpart in another table
https://dev.mysql.com/doc/refman/8.0/en/join.html

/label ~BUG

Metadata

Metadata

Assignees

Labels

resolveproblem has been fixed by developersql-coverageverifiedissue's resolve was verified by tester

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions