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

Allow any select statement for CREATE TABLE AS SELECT ... #1355

Merged
merged 3 commits into from
Oct 31, 2022

Conversation

zachmu
Copy link
Member

@zachmu zachmu commented Oct 28, 2022

Also fixes a semantics bug in the schema produced by some such statements.

@zachmu
Copy link
Member Author

zachmu commented Oct 28, 2022

This fixes dolthub/dolt#1478

@zachmu zachmu requested a review from Hydrocharged October 28, 2022 22:50
Copy link
Contributor

@Hydrocharged Hydrocharged left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -313,7 +313,7 @@ var CharsetCollationEngineTests = []CharsetCollationEngineTest{
{
Query: "SHOW CREATE TABLE test4;",
Expected: []sql.Row{
{"test4", "CREATE TABLE `test4` (\n `pk` bigint NOT NULL,\n `v1` varchar(255) COLLATE utf8mb4_unicode_ci,\n PRIMARY KEY (`pk`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"},
{"test4", "CREATE TABLE `test4` (\n `pk` bigint NOT NULL,\n `v1` varchar(255) COLLATE utf8mb4_unicode_ci\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin"},
Copy link
Contributor

Choose a reason for hiding this comment

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

I had to double check this one, but it looks like my test was wrong! It doesn't carry over primary keys, which makes sense as it also doesn't carry over indexes, so it would have to special-case it for primary keys, which doesn't really make sense. A small detail that I didn't catch, just assumed it brought those over. I checked this against MySQL the first time too, that makes it even worse lol

Copy link
Contributor

Choose a reason for hiding this comment

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

Also I saw the comment later on regarding stripping the schema. Wrote the above comment before I got to that part in the review.

Copy link
Member Author

Choose a reason for hiding this comment

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

The rare Daylon error, hard to catch you slippin

@zachmu zachmu merged commit 198bc5d into main Oct 31, 2022
@Hydrocharged Hydrocharged deleted the zachmu/create-as branch March 29, 2023 01:09
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.

2 participants