-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Allow auto_increment
on non-primary key columns
#936
Conversation
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.
Generally looks good, Need to revert the Index
interface change
sql/index.go
Outdated
@@ -49,6 +49,8 @@ type Index interface { | |||
// ColumnExpressionTypes returns each expression and its associated Type. Each expression string should exactly | |||
// match the string returned from Index.Expressions(). | |||
ColumnExpressionTypes(ctx *Context) []ColumnExpressionType | |||
// ColumnNames returns the names of the Columns that this Index is defined over | |||
ColumnNames() []string |
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.
This method is effectively a duplicate of Expressions() []string
. Instead of adding ColumnNames()
, you should use the Expressions()
in combination with GetColumnFromIndExpr
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.
LGTM!
Fix for: dolthub/dolt#2981
Since Unique Keys are not a part of
sql.Schema
andsql.Column
, we need to check if there are any valid indexes defined over the columns we want to mark asauto_increment
.Added skipped tests for queries that don't work.
TODO:
auto_increment
addsNOT NULL
constraint tooalter table t add column j int unique
firstauto_incremented