diff --git a/jOOQ/src/main/java/org/jooq/impl/AlterSequenceImpl.java b/jOOQ/src/main/java/org/jooq/impl/AlterSequenceImpl.java index 3e88c48d38..8006d4f577 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AlterSequenceImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/AlterSequenceImpl.java @@ -143,6 +143,8 @@ final class AlterSequenceImpl extends AbstractRowCountQuery im final Sequence $sequence() { return sequence; } final boolean $ifExists() { return ifExists; } final Sequence $renameTo() { return renameTo; } + final boolean $restart() { return restart; } + final Field $restartWith() { return restartWith; } final Field $startWith() { return startWith; } final Field $incrementBy() { return incrementBy; } final Field $minvalue() { return minvalue; } diff --git a/jOOQ/src/main/java/org/jooq/impl/DDLInterpreter.java b/jOOQ/src/main/java/org/jooq/impl/DDLInterpreter.java index 2a57c18e86..3b54769273 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DDLInterpreter.java +++ b/jOOQ/src/main/java/org/jooq/impl/DDLInterpreter.java @@ -726,34 +726,42 @@ final class DDLInterpreter { } else { Field startWith = query.$startWith(); - if (startWith != null) + boolean seen = false; + if (startWith != null && (seen |= true)) existing.startWith = startWith; Field incrementBy = query.$incrementBy(); - if (incrementBy != null) + if (incrementBy != null && (seen |= true)) existing.incrementBy = incrementBy; Field minvalue = query.$minvalue(); - if (minvalue != null) + if (minvalue != null && (seen |= true)) existing.minValue = minvalue; - else if (query.$noMinvalue()) + else if (query.$noMinvalue() && (seen |= true)) existing.minValue = null; Field maxvalue = query.$maxvalue(); - if (maxvalue != null) + if (maxvalue != null && (seen |= true)) existing.maxValue = maxvalue; - else if (query.$noMaxvalue()) + else if (query.$noMaxvalue() && (seen |= true)) existing.maxValue = null; Boolean cycle = query.$cycle(); - if (cycle != null) + if (cycle != null && (seen |= true)) existing.cycle = cycle; Field cache = query.$cache(); - if (cache != null) + if (cache != null && (seen |= true)) existing.cache = cache; - else if (query.$noCache()) + else if (query.$noCache() && (seen |= true)) existing.cache = null; + + if ((query.$restart() || query.$restartWith() != null) && (seen |= true)) + // ignored + ; + + if (!seen) + throw unsupportedQuery(query); } } @@ -1436,12 +1444,12 @@ final class DDLInterpreter { @SuppressWarnings("unchecked") InterpretedSequence(Schema schema) { super(MutableSequence.this.name, schema, BIGINT, false, - (Field) startWith, - (Field) incrementBy, - (Field) minValue, - (Field) maxValue, - cycle, - (Field) cache); + (Field) MutableSequence.this.startWith, + (Field) MutableSequence.this.incrementBy, + (Field) MutableSequence.this.minValue, + (Field) MutableSequence.this.maxValue, + MutableSequence.this.cycle, + (Field) MutableSequence.this.cache); } } } diff --git a/jOOQ/src/main/java/org/jooq/impl/Diff.java b/jOOQ/src/main/java/org/jooq/impl/Diff.java index ec4fd7068f..f43a57e131 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Diff.java +++ b/jOOQ/src/main/java/org/jooq/impl/Diff.java @@ -588,6 +588,45 @@ package org.jooq.impl; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +