-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Add create view support #8001
Add create view support #8001
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
Well done. |
449889c
to
503e0d7
Compare
Do some commit clean... |
ed49dea
to
e52330f
Compare
e52330f
to
8ad8f80
Compare
@AndrewDi will file a proposal for the details of supporting View these days. |
ddl/ddl.go
Outdated
@@ -19,6 +19,7 @@ package ddl | |||
|
|||
import ( | |||
"fmt" | |||
"github.com/pingcap/tidb/expression" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reorg the import packages.
I will implement this feature with independent PRs. |
How is the SQL mode handled with views - I assume it is dependent on the session executing the view? (The MySQL compatible behavior is to capture the SQL mode when the view is created.) |
@morgo A minor case of view in MySQL, it seems that everything is frozen after CREATE_VIEW: mysql> create view v as select "a" from t;
Query OK, 0 rows affected (0.03 sec)
mysql> select "a" from t;
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)
mysql> select * from v;
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)
mysql> set @@sql_mode='ANSI_QUOTES'; Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> select "a" from t
-> ;
+------+
| a |
+------+
| NULL |
+------+
1 row in set (0.00 sec)
mysql> select * from v;
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec) |
What problem does this PR solve?
Implement view support, support following grammar:
issue ref #7974
Part of the code reference from #4874
What is changed and how it works?
Use tableinfo to store view select statement
Check List
Tests
Code changes
Add CreateView interface to ddl/ddl.go
Side effects
Related changes
This change is