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

view's don't have index, SELECT ... FROM <view> USE INDEX (...) should result error #32683

Closed
ramanich1 opened this issue Mar 1, 2022 · 2 comments · Fixed by #33474
Closed
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@ramanich1
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1;
drop view if exists v1,v2;
CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
SHOW INDEX FROM v1;

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

mysql> SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
ERROR 1176 (42000): Key 'PRIMARY' doesn't exist in table 'v1'
mysql> SHOW INDEX FROM v1;
Empty set (0.01 sec)

3. What did you see instead (Required)

mysql> SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+----+------+
| c1 | c2   |
+----+------+
|  2 |    2 |
+----+------+
1 row in set (0.00 sec)

mysql> SHOW INDEX FROM v1;
Empty set (0.00 sec)

4. What is your TiDB version? (Required)

| Release Version: v5.5.0-alpha-182-gad9430039
Edition: Community
Git Commit Hash: ad9430039f54bb9af78d44831c176bc5eafcbba0
Git Branch: master
UTC Build Time: 2022-02-18 17:57:13
GoVersion: go1.17.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
@ramanich1 ramanich1 added the type/bug The issue is confirmed as a bug. label Mar 1, 2022
@seiya-annie seiya-annie added severity/moderate sig/sql-infra SIG: SQL Infra sig/planner SIG: Planner and removed sig/sql-infra SIG: SQL Infra labels Mar 1, 2022
@winoros winoros added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. severity/minor and removed severity/moderate labels Mar 21, 2022
@winoros
Copy link
Member

winoros commented Mar 21, 2022

It's a very simple problem. We downgrade the severity.

@fanrenhoo
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. severity/minor sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants