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: ALTER TABLE ADD {,COLUMN,CONSTRAINT} support #2435

Merged
merged 4 commits into from
Sep 11, 2015
Merged

sql: ALTER TABLE ADD {,COLUMN,CONSTRAINT} support #2435

merged 4 commits into from
Sep 11, 2015

Conversation

tamird
Copy link
Contributor

@tamird tamird commented Sep 9, 2015

Work toward #2035.

There are potential conflicts between this, #2430, and #2434.

I've intentionally avoided test cases which exercise constraint-as-index.

@tamird tamird changed the title sql: ALTER TABLE sql: ALTER TABLE ADD {,COLUMN,CONSTRAINT} support Sep 9, 2015

// AlterTable creates a table.
// Privileges: CREATE on database.
// Notes: postgres/mysql require CREATE on database.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like you're checking for CREATE privilege on the table. Perhaps I'm not understanding the notation here. @mberhault?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the comment

@petermattis
Copy link
Collaborator

LGTM. What conflicts with #2434 are you worried about? That change will remove the ability to create a non-unique index using ALTER TABLE, which is exactly what you want. Though I suppose it would make sense to allow ALTER TABLE ... ADD INDEX ....

@petermattis
Copy link
Collaborator

LGTM

@tamird
Copy link
Contributor Author

tamird commented Sep 10, 2015

@petermattis can you take another look? it took some refactoring, but this implementation now shares backfill code with CREATE INDEX.

var b client.Batch
// Get all the rows affected.
// TODO(vivek): Avoid going through Select.
// TODO(tamird): Support partial indexes?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realize this is a cut&paste comment. I'm not sure if we'll ever support partial indexes. Have you seen them used in practice?

Copy link
Contributor

Choose a reason for hiding this comment

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

Never seen them used since MySQL doesn't support them, but I've seen cases where we would have used them if they were available. They're not strictly necessary, but nice to have.

@petermattis
Copy link
Collaborator

LGTM

tamird added a commit that referenced this pull request Sep 11, 2015
sql: ALTER TABLE ADD {,COLUMN,CONSTRAINT} support
@tamird tamird merged commit d8e5095 into cockroachdb:master Sep 11, 2015
@tamird tamird deleted the sql-alter-table branch September 11, 2015 01:54
pav-kv pushed a commit to pav-kv/cockroach that referenced this pull request Mar 5, 2024
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.

3 participants