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

support CREATE VIEW ... UnionStmt #572

Merged
merged 6 commits into from
Oct 11, 2019
Merged

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Oct 10, 2019

What problem does this PR solve?

Before this:

tidb> create view v as select * from t1 union select * from t1;
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 39 near "union select * from t1"
tidb> create view v as (select * from t1);
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 18 near "(select * from t1)"

What is changed and how it works?

After this, create view on union and create view on (select) syntax are supported.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

@codecov
Copy link

codecov bot commented Oct 10, 2019

Codecov Report

Merging #572 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #572   +/-   ##
=======================================
  Coverage   71.77%   71.77%           
=======================================
  Files          32       32           
  Lines        7820     7820           
=======================================
  Hits         5613     5613           
  Misses       1676     1676           
  Partials      531      531
Impacted Files Coverage Δ
parser.go 70.37% <ø> (ø) ⬆️
ast/ddl.go 80.48% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7586d61...541bcec. Read the comment docs.

Copy link
Contributor

@wshwsh12 wshwsh12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql 8.0> create view v as (select * from t union select * from t);
Query OK, 0 rows affected (0.00 sec)
tidb> create view v as (select * from t union select * from t);
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 39 near "union select * from t)"

I think that create view on (union) syntax should be supported, too.

Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rest LGTM

ast/ddl.go Outdated Show resolved Hide resolved
parser.y Outdated Show resolved Hide resolved
parser.y Outdated Show resolved Hide resolved
@XuHuaiyu XuHuaiyu requested a review from kennytm October 11, 2019 02:55
ast/ddl.go Outdated Show resolved Hide resolved
parser.y Outdated Show resolved Hide resolved
@XuHuaiyu XuHuaiyu requested a review from kennytm October 11, 2019 03:03
Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kennytm kennytm added the status/LGT1 LGT1 label Oct 11, 2019
Copy link
Contributor

@wshwsh12 wshwsh12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XuHuaiyu XuHuaiyu merged commit e606d9a into pingcap:master Oct 11, 2019
@wshwsh12 wshwsh12 added status/LGT2 LGT2 and removed status/LGT1 LGT1 labels Oct 11, 2019
@XuHuaiyu XuHuaiyu deleted the view_on_union branch October 11, 2019 05:55
XuHuaiyu added a commit to XuHuaiyu/parser that referenced this pull request Oct 11, 2019
XuHuaiyu added a commit to XuHuaiyu/parser that referenced this pull request Oct 11, 2019
tiancaiamao pushed a commit to tiancaiamao/parser that referenced this pull request Apr 27, 2021
lyonzhi pushed a commit to lyonzhi/parser that referenced this pull request Apr 25, 2024
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 this pull request may close these issues.

3 participants