-
Notifications
You must be signed in to change notification settings - Fork 3.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
sql: support CREATE TABLE ... LIKE for tables with hidden columns #67196
Comments
I think there's a bigger picture question to answer first: What is the expected behavior of By default, To be consisten, the locality should probably not be copied by default. It currently is copied, but incorrectly:
We could introduce a new option to opt into copying the locality from the source table, CREATE TABLE copy (LIKE regional_by_row_table INCLUDING LOCALITY) |
@awoods187 what is the desired behaviour here?
|
not copying hidden columns seems pretty broken to me. for example, implicit
|
cc @vy-ton i think this is a more general SQL experience issue ^ |
It seems like we'd want to copy hidden columns since the contract is to create the same semantics of the table. If someone just wants a table without everything being the same, they can use CREATE TABLE AS... |
The last two statements in the logic tests below fail with
column "crdb_region" does not exist
. It probably is caused an incorrect assumption here that the system will recreate thecrdb_region
column, but it does not.:cockroach/pkg/sql/create_table.go
Lines 2557 to 2561 in 1e0aaa5
this is also broken for implicit rowid tables, when used with indexes:
or even just HIDDEN columns in general:
Epic CRDB-7217
The text was updated successfully, but these errors were encountered: