[jOOQ/jOOQ#9557] Add support for ALTER TABLE .. DROP CONSTRAINT IF

EXISTS

- Added parser support
This commit is contained in:
Lukas Eder 2019-11-18 11:27:19 +01:00
parent fa21941e6e
commit 8461680d28

View File

@ -3791,7 +3791,9 @@ final class ParserImpl implements Parser {
case 'D':
if (parseKeywordIf(ctx, "DROP")) {
if (parseKeywordIf(ctx, "CONSTRAINT")) {
return parseCascadeRestrictIf(ctx, s1.dropConstraint(parseIdentifier(ctx)));
return parseCascadeRestrictIf(ctx, parseKeywordIf(ctx, "IF EXISTS")
? s1.dropConstraintIfExists(parseIdentifier(ctx))
: s1.dropConstraint(parseIdentifier(ctx)));
}
else if (parseKeywordIf(ctx, "UNIQUE")) {
return parseCascadeRestrictIf(ctx, s1.dropUnique(parseIdentifier(ctx)));
@ -3805,8 +3807,7 @@ final class ParserImpl implements Parser {
}
else if (parseKeywordIf(ctx, "INDEX")
|| parseKeywordIf(ctx, "KEY")) {
Name index = parseIdentifier(ctx);
return ctx.dsl.dropIndex(index).on(tableName);
return ctx.dsl.dropIndex(parseIdentifier(ctx)).on(tableName);
}
else {
parseKeywordIf(ctx, "COLUMN");