You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mysql -h "127.0.0.1" -u root -P 4000 -D testdb
mysql> insert into t_dpjl2b values
(83, 82, 'a', 0, 68.100, 65.63, 39, null);
mysql> select 0 as c0
union
select 0 as c0
from
(t_ragkdc as ref_2
left outer join (t__z4n6d as ref_3
inner join t_dpjl2b as ref_4
on (ref_3.c2 = ref_4.c_l4g6hb ))
on (ref_2.c0 = ref_4.c_hev4cb ))
where ref_4.c_vtks > 0;
Testcase 2
mysql -h "127.0.0.1" -u root -P 4000 -D testdb
mysql> start transaction;
mysql> insert into t_dpjl2b values
(83, 82, 'a', 0, 68.100, 65.63, 39, null);
mysql> select 0 as c0
union
select 0 as c0
from
(t_ragkdc as ref_2
left outer join (t__z4n6d as ref_3
inner join t_dpjl2b as ref_4
on (ref_3.c2 = ref_4.c_l4g6hb ))
on (ref_2.c0 = ref_4.c_hev4cb ))
where ref_4.c_vtks > 0;
mysql> commit;
2. What did you expect to see? (Required)
The outputs of SELECT statements in Testcase 1 and Testcase 2 are same.
mysql -h "127.0.0.1" -u root -P 4000 -D testdb < mysql_bk.sql
-- MySQL returns 88 rows as the result
SELECT CASE WHEN c0 <= (SELECT 1 FROM t_dpjl2b) THEN 1 ELSE 2 END FROM t_oc6jub;
-- TiDB returns ERROR 1242 (21000): Subquery returns more than 1 row
SELECT CASE WHEN c0 <= (SELECT 1 FROM t_dpjl2b) THEN 1 ELSE 2 END FROM t_oc6jub;
Actually, TiDB's behavior is more reasonable since the subquery returns 11 rows:
JZuming
changed the title
TiDB (with tikv) produces different results for SELECT statements when using transaction
TiDB produces different results for SELECT statements (Subquery returns more than 1 row)
Sep 23, 2022
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Setup the environment:
mysql_bk.sql:
mysql_bk.sql.txt
Testcase 1
Testcase 2
2. What did you expect to see? (Required)
The outputs of SELECT statements in Testcase 1 and Testcase 2 are same.
3. What did you see instead (Required)
Output of SELECT statement in Testcase 1
Output of SELECT statement in Testcase 2
Their results are different.
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: