Incorrect result for join query with LIMIT,OFFSET
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Stado |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
I have 3 tables: a,b,and repl. Table a and b are partitioned tables. Table repl is a replicated table.
I try to execute below queries:
1) select * from a,b limit 2 offset 2;
2) select * from b,a limit 2 offset 2;
3) select * from a,repl limit 2 offset 2;
4) select * from repl,a limit 2 offset 2;
5) select * from a x,a y limit 2 offset 2;
6) select * from repl x, repl y limit 2 offset 2;
The results show that Query 3) and Query 6) get the incorrect results.
Seems we will get the incorrect results if the second table is a replicated table.
=======
Stado -> select * from a;
+-------+
| x | y |
+-------+
| 1 | 1 |
| 1 | 2 |
| 1 | 3 |
| 1 | 4 |
+-------+
4 row(s).
Stado -> select * from b;
+-------+
| x | y |
+-------+
| 1 | 5 |
| 1 | 6 |
| 1 | 7 |
| 1 | 8 |
+-------+
4 row(s).
Stado -> select * from repl;
+----+
| id |
+----+
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
+----+
5 row(s).
Stado -> select * from a,b limit 2 offset 2;
+---------------+
| x | y | x | y |
+---------------+
| 1 | 3 | 1 | 5 |
| 1 | 4 | 1 | 5 |
+---------------+
2 row(s).
Stado -> select * from b,a limit 2 offset 2;
+---------------+
| x | y | x | y |
+---------------+
| 1 | 7 | 1 | 1 |
| 1 | 8 | 1 | 1 |
+---------------+
2 row(s).
Stado -> select * from a,repl limit 2 offset 2;
no rows to display
Stado -> select * from repl,a limit 2 offset 2;
+------------+
| id | x | y |
+------------+
| 3 | 1 | 1 |
| 4 | 1 | 1 |
+------------+
2 row(s).
Stado -> select * from a x,a y limit 2 offset 2;
+---------------+
| x | y | x | y |
+---------------+
| 1 | 3 | 1 | 1 |
| 1 | 4 | 1 | 1 |
+---------------+
2 row(s).
Stado -> select * from repl x, repl y limit 2 offset 2;
no rows to display
Related branches
Changed in stado: | |
status: | New → Fix Committed |