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

refactor index validation and prevent indexes over json columns #2469

Merged
merged 13 commits into from
Apr 30, 2024
Merged

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Apr 24, 2024

This PR consolidates the logic to validate if an index.
Additionally, it fixes a bug where create table t (i int, index (i, i)); was allowed.

fixes: dolthub/dolt#6064

@@ -1806,74 +1806,79 @@ func getCheckAlterableTable(t sql.Table) (sql.CheckAlterableTable, error) {
}
}

// generateIndexName generates a unique index name based on the columns in the index, and any existing indexes on the table.
func generateIndexName(ctx *sql.Context, idxAltable sql.IndexAlterableTable, idxColNames []string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

the comment above that this is different than Dolt's implementation is maybe informative to keep?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't find the deleted comment, but I think I might've been mistaken before.

Copy link
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

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

lgtm, all seems reasonable!

@jycor jycor merged commit b241685 into main Apr 30, 2024
7 checks passed
@jycor jycor deleted the james/json branch April 30, 2024 18:16
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.

Prevent Indexing JSON Fields
2 participants