[#6132] [#6485] Add parser support for the ON UPDATE column type clause

This commit is contained in:
lukaseder 2018-01-12 17:11:38 +01:00
parent 247c8b2dcd
commit 12bb3efbcc
2 changed files with 23 additions and 0 deletions

View File

@ -234,6 +234,7 @@ column =
(
[ 'NOT' ] 'NULL'
| 'DEFAULT' [ 'ON NULL' ] concat
| 'ON UPDATE' concat
| 'GENERATED' ( 'ALWAYS' | 'BY DEFAULT' [ 'ON NULL' ] ) 'AS IDENTITY' '('
[ identity ]
')'

View File

@ -1630,6 +1630,7 @@ final class ParserImpl implements Parser {
boolean nullable = false;
boolean defaultValue = false;
boolean onUpdate = false;
boolean unique = false;
boolean identity = type.identity();
boolean comment = false;
@ -1715,6 +1716,16 @@ final class ParserImpl implements Parser {
}
}
if (!onUpdate) {
if (parseKeywordIf(ctx, "ON UPDATE")) {
// [#6132] TODO: Support this feature in the jOOQ DDL API
parseConcat(ctx, null);
onUpdate = true;
continue;
}
}
if (!unique) {
if (parseKeywordIf(ctx, "PRIMARY KEY")) {
constraints.add(primaryKey(fieldName));
@ -2097,6 +2108,7 @@ final class ParserImpl implements Parser {
boolean nullable = false;
boolean defaultValue = false;
boolean onUpdate = false;
boolean unique = false;
boolean comment = false;
@ -2122,6 +2134,16 @@ final class ParserImpl implements Parser {
}
}
if (!onUpdate) {
if (parseKeywordIf(ctx, "ON UPDATE")) {
// [#6132] TODO: Support this feature in the jOOQ DDL API
parseConcat(ctx, null);
onUpdate = true;
continue;
}
}
if (!unique)
if (parseKeywordIf(ctx, "PRIMARY KEY"))
throw ctx.unexpectedToken();