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

"order by + num " can use a column not in select fields #24667

Open
time-and-fate opened this issue May 14, 2021 · 6 comments · May be fixed by #24669 or #34871
Open

"order by + num " can use a column not in select fields #24667

time-and-fate opened this issue May 14, 2021 · 6 comments · May be fixed by #24669 or #34871
Assignees
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@time-and-fate
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a int, b int, c int);
select a from t group by a having sum(b) > 0 order by 1;
select a from t group by a having sum(b) > 0 order by 2;
select a from t group by a having sum(b) > 0 order by 3;

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

> select a from t group by a having sum(b) > 0 order by 1;
Empty set (0.029 sec)

> select a from t group by a having sum(b) > 0 order by 2;
ERROR 1054 (42S22): Unknown column '2' in 'order clause'
> select a from t group by a having sum(b) > 0 order by 3;
ERROR 1054 (42S22): Unknown column '3' in 'order clause'

3. What did you see instead (Required)

> select a from t group by a having sum(b) > 0 order by 1;
Empty set (0.006 sec)

> select a from t group by a having sum(b) > 0 order by 2;
Empty set (0.006 sec)

> select a from t group by a having sum(b) > 0 order by 3;
Empty set (0.007 sec)

4. What is your TiDB version? (Required)

current master (ea7f0ca)

@time-and-fate time-and-fate added the type/bug The issue is confirmed as a bug. label May 14, 2021
@time-and-fate
Copy link
Member Author

/assign time-and-fate

@time-and-fate
Copy link
Member Author

/sig planner

@ti-chi-bot ti-chi-bot added the sig/planner SIG: Planner label May 14, 2021
@time-and-fate
Copy link
Member Author

/remove-sig infra

@ti-chi-bot
Copy link
Member

@time-and-fate: These labels are not set on the issue: sig/infra.

In response to this:

/remove-sig infra

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@time-and-fate
Copy link
Member Author

remove-sig sql-infra

@time-and-fate
Copy link
Member Author

/remove-sig sql-infra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
4 participants