-
Notifications
You must be signed in to change notification settings - Fork 20
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
Max/drop pk #83
Max/drop pk #83
Conversation
go/vt/sqlparser/ast.go
Outdated
@@ -2288,18 +2288,24 @@ type IndexSpec struct { | |||
Columns []*IndexColumn | |||
// Options contains the index options when creating an index | |||
Options []*IndexOption | |||
// Primary indicates a PRIMARY KEY create or delete operation | |||
Primary bool |
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 should be a part of the type parameter not a new field on a struct
go/vt/sqlparser/ast.go
Outdated
@@ -2288,18 +2288,24 @@ type IndexSpec struct { | |||
Columns []*IndexColumn | |||
// Options contains the index options when creating an index | |||
Options []*IndexOption | |||
// Primary indicates a PRIMARY KEY create or delete operation | |||
Primary bool | |||
} | |||
|
|||
func (idx *IndexSpec) Format(buf *TrackedBuffer) { |
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.
Why are we using this as an index and not a constraint?
go/vt/sqlparser/parse_test.go
Outdated
input: "alter table a add primary key", | ||
output: "alter table a", | ||
input: "alter table a add primary key (a, b)", | ||
output: "alter table a add constraint PRIMARY primary key (a, b)", |
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 seems like incorrect formatting. The output wouldn't run on mysql
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
go/vt/sqlparser/sql.y
Outdated
@@ -2174,6 +2174,15 @@ constraint_symbol_opt: | |||
$$ = string($2) | |||
} | |||
|
|||
pk_symbol_opt: |
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.
pk_name_opt
Signed-off-by: Vinai Rachakonda <rachakondavinai@gmail.com>
No description provided.