[#7268] Add support for MySQL's UNIQUE [ index_name ] syntax
This commit is contained in:
parent
928175ed41
commit
b06cd5f5d0
@ -307,7 +307,7 @@ index = ( 'KEY' | 'INDEX' ) [ identifier ] '(' sortFields ')'
|
||||
constraint =
|
||||
(
|
||||
'PRIMARY KEY' '(' fieldNames ')'
|
||||
| 'UNIQUE' [ 'KEY' | 'INDEX' ] '(' fieldNames ')'
|
||||
| 'UNIQUE' [ 'KEY' | 'INDEX' ] [ identifier ] '(' sortFields ')'
|
||||
| 'FOREIGN KEY' '(' fieldNames ')' 'REFERENCES' constraintReferenceSpecification
|
||||
| 'CHECK' '(' condition ')'
|
||||
) [ 'ENABLE' ]
|
||||
|
||||
@ -2452,6 +2452,12 @@ final class ParserImpl implements Parser {
|
||||
if (!parseKeywordIf(ctx, "KEY"))
|
||||
parseKeywordIf(ctx, "INDEX");
|
||||
|
||||
// [#7268] MySQL has some legacy syntax where an index name
|
||||
// can override a constraint name
|
||||
Name index = parseIdentifierIf(ctx);
|
||||
if (index != null)
|
||||
constraint = constraint(index);
|
||||
|
||||
constraints.add(parseUniqueSpecification(ctx, constraint));
|
||||
continue columnLoop;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user