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

Delete PRI, UNI constraint in create_table_as marco #10

Merged
merged 4 commits into from
Aug 12, 2022

Conversation

Daemonxiao
Copy link
Contributor

@Daemonxiao Daemonxiao commented Aug 11, 2022

What problem does this PR solve?

CREATE TABLE AS SELECT should not copy PRI and UNI constraints.
For more information about this SQL, see the MySQL document.
It says that:

CREATE TABLE ... SELECT does not automatically create any indexes for you. This is done intentionally to make the statement as flexible as possible. If you want to have indexes in the created table, you should specify these before the SELECT statement:
For CREATE TABLE ... SELECT, the destination table does not preserve information about whether columns in the selected-from table are generated columns. The SELECT part of the statement cannot assign values to generated columns in the destination table.
For CREATE TABLE ... SELECT, the destination table does preserve expression default values from the original table.

So we need to add DEFAULT message in tidb__create_table_as marco.

What is changed and how does it work?

Delete PRI, UNI in tidb__create_table_as marco.

Check List

  • unit test
  • integration test
  • modify doc
  • change source code

@zhangyangyu zhangyangyu merged commit f5394de into pingcap:main Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants