-
Notifications
You must be signed in to change notification settings - Fork 456
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
CREATE TABLE AS updates #5247
CREATE TABLE AS updates #5247
Conversation
@jseldess I added a partitioning-relevant example. Please review that for comprehension and accuracy. We can discuss more offline, but the example is limited. I figured including an entire set of instructions for setting up nodes and localities would would a little overkill. Let me know if you disagree. |
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.
A few minor edits but otherwise LGTM!
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @ericharmeling, @jseldess, and @lhirata)
v19.2/create-table-as.md, line 7 at r1 (raw file):
--- The `CREATE TABLE ... AS` statement creates a new table from a [selection query](selection-queries.html).
Add link to statement
v19.2/create-table-as.md, line 59 at r1 (raw file):
<div> {% include {{ page.version.version }}/sql/diagrams/family_def.html %}
This diagram is a little confusing because it says opt_family_name
and then name
. Maybe name
should be column_name
?
v19.2/create-table-as.md, line 138 at r1 (raw file):
### Change column names This statement creates a copy of an existing table but with changed column names.
Switch period to colon at end of sentence
v19.2/create-table-as.md, line 142 at r1 (raw file):
{% include copy-clipboard.html %} ~~~ sql > CREATE TABLE users_ny_names (id, name) AS SELECT id, name FROM users WHERE city = 'new york';
Which column names are changed? To show the change, should the example instead be something like CREATE TABLE users_ny_names (user_id, user_name) AS SELECT id, name FROM ...
?
v19.2/create-table-as.md, line 203 at r1 (raw file):
When a table copy is created this way, the copy is not associated to any primary key, secondary index or constraint that was present on the
Add an Oxford comma
v19.2/create-table-as.md, line 290 at r1 (raw file):
### Specify a primary key for partitioning If you are [partitioning](partitioning.html) a table based on a primary key, you must correctly define the primary key at table creation. It is not possible to add or change primary keys after table creation. To work around this limitation, you can create a new table from an existing one, with the correct primary keys specified in your `CREATE TABLE ... AS` statement.
Maybe link to the primary key docs here.
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @jseldess and @lhirata)
v19.2/create-table-as.md, line 7 at r1 (raw file):
Previously, lhirata wrote…
Add link to statement
Done.
v19.2/create-table-as.md, line 59 at r1 (raw file):
Previously, lhirata wrote…
This diagram is a little confusing because it says
opt_family_name
and thenname
. Maybename
should becolumn_name
?
I'm just going to remove the family_def diagram from here. I don't think it adds anything.
v19.2/create-table-as.md, line 138 at r1 (raw file):
Previously, lhirata wrote…
Switch period to colon at end of sentence
Done.
v19.2/create-table-as.md, line 142 at r1 (raw file):
Previously, lhirata wrote…
Which column names are changed? To show the change, should the example instead be something like
CREATE TABLE users_ny_names (user_id, user_name) AS SELECT id, name FROM ...
?
Good catch! Done.
v19.2/create-table-as.md, line 203 at r1 (raw file):
Previously, lhirata wrote…
Add an Oxford comma
Done.
v19.2/create-table-as.md, line 290 at r1 (raw file):
Previously, lhirata wrote…
Maybe link to the primary key docs here.
Done.
Parameter updates Diagram updates Examples now use MovR New primary key example for partitioning Code PRs: cockroachdb/cockroach#38589 cockroachdb/cockroach#38904 Fixes #5190
Code PRs:
cockroachdb/cockroach#38589
cockroachdb/cockroach#38904
Fixes #5190