Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Results of count(col) and count(1) may be different #19504

Closed
zyguan opened this issue Aug 26, 2020 · 0 comments · Fixed by #19567
Closed

Results of count(col) and count(1) may be different #19504

zyguan opened this issue Aug 26, 2020 · 0 comments · Fixed by #19567
Assignees
Labels
component/expression priority/P1 The issue has P1 priority. severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@zyguan
Copy link
Contributor

zyguan commented Aug 26, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1;
create table t1 (c_int int, primary key (c_int));
insert into t1 values (1), (2), (3);
drop table if exists t2;
create table t2 (c_int int, primary key (c_int));
insert into t2 values (1);
select (select count(c_int) from t2 where c_int = t1.c_int) c1, (select count(1) from t2 where c_int = t1.c_int) c2 from t1;

2. What did you expect to see? (Required)

+------+------+
| c1   | c2   |
+------+------+
|    1 |    1 |
|    0 |    0 |
|    0 |    0 |
+------+------+

3. What did you see instead (Required)

+----+----+
| c1 | c2 |
+----+----+
|  1 |  1 |
|  1 |  0 |
|  1 |  0 |
+----+----+

4. What is your TiDB version? (Required)

master @ 602afed
release-4.0 @ 397fce9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression priority/P1 The issue has P1 priority. severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants