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

can't create binding for union all statements #19932

Closed
zz-jason opened this issue Sep 10, 2020 · 5 comments · Fixed by #20010
Closed

can't create binding for union all statements #19932

zz-jason opened this issue Sep 10, 2020 · 5 comments · Fixed by #20010
Assignees
Labels

Comments

@zz-jason
Copy link
Member

Bug Report

1. Minimal reproduce step (Required)

-- init table:
drop table if exists t;
create table t(a bigint, b bigint, index a(a));

-- create a global binding for union all statement:
create binding for
select * from t union all select * from t
using
select * from t use index(a) union all select * from t use index();

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

created successfully.

3. What did you see instead (Required)

TiDB(root@127.0.0.1:test) > create binding for select * from t union all select * from t using select * from t use index(a) union all select * from t use index();
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 40 near "union all select * from t using select * from t use index(a) union all select * from t use index()"

4. What is your TiDB version? (Required)

TiDB(root@127.0.0.1:test) > select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v4.0.0-beta.2-1189-g7b6a5cdb7
Edition: Community
Git Commit Hash: 7b6a5cdb76dbf70d2ae2d01fa9b0fe0d6048ab88
Git Branch: master
UTC Build Time: 2020-09-09 09:03:38
GoVersion: go1.15
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec)
@zz-jason zz-jason added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner epic/sql-plan-management labels Sep 10, 2020
@winoros
Copy link
Member

winoros commented Sep 10, 2020

The parser only dealed with SelectStmt while the UNION ALL is SetOprStmt

@rebelice
Copy link
Contributor

/assign @rebelice

@sre-bot
Copy link
Contributor

sre-bot commented Oct 9, 2020

Integrity check:
RCA symptom trigger_condition affect_version fix_version fields are empty
@rebelice
Please comment /info to get template

@ti-srebot
Copy link
Contributor

Please edit this comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA)

2. Symptom

3. All Trigger Conditions

4. Workaround (optional)

5. Affected versions

6. Fixed versions

@rebelice
Copy link
Contributor

rebelice commented Oct 13, 2020

Please edit this comment to complete the following information

Bug

1. Root Cause Analysis (RCA)

SQL BINDING only dealed with SelectStmt while the UNION ALL is SetOprStmt.

2. Symptom

You have an error in your SQL syntax.

3. All Trigger Conditions

Try to create binding for union all statements.

4. Workaround (optional)

5. Affected versions

[v4.0.0:v4.0.7]

6. Fixed versions

v4.0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants