[#6485] Support parsing SQL Server's IDENTITY and IDENTITY(x, y) syntax

This commit is contained in:
lukaseder 2018-01-26 17:16:09 +01:00
parent dc2e9b21a4
commit 2fc5c410d2
2 changed files with 15 additions and 1 deletions

View File

@ -263,6 +263,7 @@ column =
| 'CHECK' '(' condition ')'
| 'AUTO_INCREMENT'
| 'AUTOINCREMENT'
| 'IDENTITY' [ '(' signedInteger ',' signedInteger ')' ]
| 'COMMENT' stringLiteral
)
}

View File

@ -1851,7 +1851,20 @@ final class ParserImpl implements Parser {
}
if (!defaultValue) {
if (parseKeywordIf(ctx, "DEFAULT")) {
if (parseKeywordIf(ctx, "IDENTITY")) {
if (parseIf(ctx, '(')) {
parseSignedInteger(ctx);
parse(ctx, ',');
parseSignedInteger(ctx);
parse(ctx, ')');
}
type = type.identity(true);
defaultValue = true;
identity = true;
continue;
}
else if (parseKeywordIf(ctx, "DEFAULT")) {
// TODO: Ignored keyword from Oracle
parseKeywordIf(ctx, "ON NULL");