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

sql: copy hidden columns in CREATE TABLE LIKE #67799

Merged
merged 1 commit into from
Jul 22, 2021

Conversation

otan
Copy link
Contributor

@otan otan commented Jul 20, 2021

Resolves #67196

Release note (sql change): CREATE TABLE LIKE now copies hidden columns
over.

@otan otan requested a review from rafiss July 20, 2021 08:38
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@@ -340,13 +341,28 @@ SHOW CREATE TABLE like_hash
----
like_hash CREATE TABLE public.like_hash (
a INT8 NULL,
crdb_internal_a_shard_4 INT4 NOT VISIBLE NOT NULL AS (mod(fnv32(COALESCE(CAST(a AS STRING), '':::STRING)), 4:::INT8)) STORED,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

so this is because INCLUDING DEFAULTS isn't in there, wonder if that's passable.

@otan otan force-pushed the like_fix branch 2 times, most recently from be98153 to d4fec08 Compare July 20, 2021 09:22
@otan otan requested a review from a team July 21, 2021 13:28
Also contains logic that restore DEFAULTs for primary key being rowid,
crdb_internal_region and hash sharded indexes.

Release note (sql change): CREATE TABLE LIKE now copies hidden columns
over.
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

ty!

@otan
Copy link
Contributor Author

otan commented Jul 22, 2021

bors r=rafiss

@craig
Copy link
Contributor

craig bot commented Jul 22, 2021

Build succeeded:

@craig craig bot merged commit f0e2aa6 into cockroachdb:master Jul 22, 2021
@mgartner
Copy link
Collaborator

Thanks!

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.

sql: support CREATE TABLE ... LIKE for tables with hidden columns
4 participants