diff --git a/jOOQ/src/main/java/org/jooq/AlterIndexFinalStep.java b/jOOQ/src/main/java/org/jooq/AlterIndexFinalStep.java
new file mode 100644
index 0000000000..c3b6deb312
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/AlterIndexFinalStep.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com)
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Other licenses:
+ * -----------------------------------------------------------------------------
+ * Commercial licenses for this work are available. These replace the above
+ * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
+ * database integrations.
+ *
+ * For more information, please visit: http://www.jooq.org/licenses
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+package org.jooq;
+
+
+/**
+ * The final step in the ALTER INDEX DSL.
+ *
+ * @author Lukas Eder
+ */
+public interface AlterIndexFinalStep extends DDLQuery {
+
+}
diff --git a/jOOQ/src/main/java/org/jooq/AlterIndexStep.java b/jOOQ/src/main/java/org/jooq/AlterIndexStep.java
new file mode 100644
index 0000000000..1d86f116ad
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/AlterIndexStep.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com)
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Other licenses:
+ * -----------------------------------------------------------------------------
+ * Commercial licenses for this work are available. These replace the above
+ * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
+ * database integrations.
+ *
+ * For more information, please visit: http://www.jooq.org/licenses
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+package org.jooq;
+
+import static org.jooq.SQLDialect.POSTGRES;
+
+/**
+ * The step in the ALTER INDEX where the action can be decided.
+ *
+ * @author Lukas Eder
+ */
+public interface AlterIndexStep {
+
+ /**
+ * Add a RENAME TO clause to the ALTER INDEX
+ * statement.
+ */
+ @Support({ POSTGRES })
+ AlterIndexFinalStep renameTo(Name newName);
+
+ /**
+ * Add a RENAME TO clause to the ALTER INDEX
+ * statement.
+ */
+ @Support({ POSTGRES })
+ AlterIndexFinalStep renameTo(String newName);
+}
diff --git a/jOOQ/src/main/java/org/jooq/AlterViewStep.java b/jOOQ/src/main/java/org/jooq/AlterViewStep.java
index 0d7744b54a..6eb319019f 100644
--- a/jOOQ/src/main/java/org/jooq/AlterViewStep.java
+++ b/jOOQ/src/main/java/org/jooq/AlterViewStep.java
@@ -50,21 +50,21 @@ import static org.jooq.SQLDialect.POSTGRES;
public interface AlterViewStep {
/**
- * Add a RENAME TO clause to the ALTER TABLE
+ * Add a RENAME TO clause to the ALTER VIEW
* statement.
*/
@Support({ POSTGRES })
AlterViewFinalStep renameTo(Table> newName);
/**
- * Add a RENAME TO clause to the ALTER TABLE
+ * Add a RENAME TO clause to the ALTER VIEW
* statement.
*/
@Support({ POSTGRES })
AlterViewFinalStep renameTo(Name newName);
/**
- * Add a RENAME TO clause to the ALTER TABLE
+ * Add a RENAME TO clause to the ALTER VIEW
* statement.
*/
@Support({ POSTGRES })
diff --git a/jOOQ/src/main/java/org/jooq/Clause.java b/jOOQ/src/main/java/org/jooq/Clause.java
index a9abe83fad..31c701df40 100644
--- a/jOOQ/src/main/java/org/jooq/Clause.java
+++ b/jOOQ/src/main/java/org/jooq/Clause.java
@@ -1081,6 +1081,33 @@ public enum Clause {
*/
ALTER_VIEW_RENAME,
+ /**
+ * A complete ALTER INDEX statement.
+ */
+ ALTER_INDEX,
+
+ /**
+ * An INDEX clause within an {@link #ALTER_INDEX} statement.
+ *
+ * This clause surrounds + *
ALTER INDEX keywordsRENAME TO clause within an {@link #ALTER_INDEX} statement.
+ * + * This clause surrounds + *
RENAME TO keywordsDROP VIEW statement.
*/
diff --git a/jOOQ/src/main/java/org/jooq/DSLContext.java b/jOOQ/src/main/java/org/jooq/DSLContext.java
index 278184c450..f90d11dbd2 100644
--- a/jOOQ/src/main/java/org/jooq/DSLContext.java
+++ b/jOOQ/src/main/java/org/jooq/DSLContext.java
@@ -7257,6 +7257,22 @@ public interface DSLContext extends Scope , AutoCloseable {
@Support
AlterViewStep alterView(Table> view);
+ /**
+ * Create a new DSL ALTER INDEX statement.
+ *
+ * @see DSL#alterIndex(String)
+ */
+ @Support
+ AlterIndexStep alterIndex(String index);
+
+ /**
+ * Create a new DSL ALTER INDEX statement.
+ *
+ * @see DSL#alterIndex(Name)
+ */
+ @Support
+ AlterIndexStep alterIndex(Name index);
+
/**
* Create a new DSL DROP VIEW statement.
*
diff --git a/jOOQ/src/main/java/org/jooq/impl/AlterIndexImpl.java b/jOOQ/src/main/java/org/jooq/impl/AlterIndexImpl.java
new file mode 100644
index 0000000000..d5c98f0659
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/impl/AlterIndexImpl.java
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2009-2016, Data Geekery GmbH (http://www.datageekery.com)
+ * All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Other licenses:
+ * -----------------------------------------------------------------------------
+ * Commercial licenses for this work are available. These replace the above
+ * ASL 2.0 and offer limited warranties, support, maintenance, and commercial
+ * database integrations.
+ *
+ * For more information, please visit: http://www.jooq.org/licenses
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ */
+package org.jooq.impl;
+
+import static org.jooq.Clause.ALTER_INDEX;
+import static org.jooq.Clause.ALTER_INDEX_INDEX;
+import static org.jooq.Clause.ALTER_INDEX_RENAME;
+import static org.jooq.impl.DSL.name;
+
+import org.jooq.AlterIndexFinalStep;
+import org.jooq.AlterIndexStep;
+import org.jooq.Clause;
+import org.jooq.Configuration;
+import org.jooq.Context;
+import org.jooq.Name;
+
+/**
+ * @author Lukas Eder
+ */
+final class AlterIndexImpl extends AbstractQuery implements
+
+ // Cascading interface implementations for ALTER INDEX behaviour
+ AlterIndexStep,
+ AlterIndexFinalStep {
+
+ /**
+ * Generated UID
+ */
+ private static final long serialVersionUID = 8904572826501186329L;
+ private static final Clause[] CLAUSES = { ALTER_INDEX };
+
+ private final Name index;
+ private Name renameTo;
+
+ AlterIndexImpl(Configuration configuration, Name index) {
+ super(configuration);
+
+ this.index = index;
+ }
+
+ // ------------------------------------------------------------------------
+ // XXX: DSL API
+ // ------------------------------------------------------------------------
+
+ @Override
+ public final AlterIndexImpl renameTo(Name newName) {
+ this.renameTo = newName;
+ return this;
+ }
+
+ @Override
+ public final AlterIndexImpl renameTo(String newName) {
+ return renameTo(name(newName));
+ }
+
+ // ------------------------------------------------------------------------
+ // XXX: QueryPart API
+ // ------------------------------------------------------------------------
+
+ @Override
+ public final void accept(Context> ctx) {
+ ctx.start(ALTER_INDEX_INDEX)
+ .keyword("alter index").sql(' ').visit(index)
+ .end(ALTER_INDEX_INDEX)
+ .formatIndentStart()
+ .formatSeparator();
+
+ if (renameTo != null) {
+ boolean qualify = ctx.qualify();
+
+ ctx.start(ALTER_INDEX_RENAME)
+ .qualify(false)
+ .keyword("rename to").sql(' ').visit(renameTo)
+ .qualify(qualify)
+ .end(ALTER_INDEX_RENAME);
+ }
+
+ ctx.formatIndentEnd();
+ }
+
+ @Override
+ public final Clause[] clauses(Context> ctx) {
+ return CLAUSES;
+ }
+}
diff --git a/jOOQ/src/main/java/org/jooq/impl/AlterViewImpl.java b/jOOQ/src/main/java/org/jooq/impl/AlterViewImpl.java
index f2b78d7228..02453a4c11 100644
--- a/jOOQ/src/main/java/org/jooq/impl/AlterViewImpl.java
+++ b/jOOQ/src/main/java/org/jooq/impl/AlterViewImpl.java
@@ -58,7 +58,7 @@ import org.jooq.Table;
*/
final class AlterViewImpl extends AbstractQuery implements
- // Cascading interface implementations for ALTER TABLE behaviour
+ // Cascading interface implementations for ALTER VIEW behaviour
AlterViewStep,
AlterViewFinalStep {
diff --git a/jOOQ/src/main/java/org/jooq/impl/DSL.java b/jOOQ/src/main/java/org/jooq/impl/DSL.java
index 7a1dce1356..fcb9b5f910 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DSL.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DSL.java
@@ -99,6 +99,7 @@ import javax.annotation.Generated;
import javax.sql.DataSource;
import org.jooq.AggregateFunction;
+import org.jooq.AlterIndexStep;
import org.jooq.AlterSequenceStep;
import org.jooq.AlterTableStep;
import org.jooq.AlterViewStep;
@@ -5206,6 +5207,26 @@ public class DSL {
return using(new DefaultConfiguration()).alterView(view);
}
+ /**
+ * Create a new DSL ALTER INDEX statement.
+ *
+ * @see DSLContext#alterIndex(String)
+ */
+ @Support
+ public static AlterIndexStep alterIndex(String index) {
+ return using(new DefaultConfiguration()).alterIndex(index);
+ }
+
+ /**
+ * Create a new DSL ALTER INDEX statement.
+ *
+ * @see DSLContext#alterIndex(Name)
+ */
+ @Support
+ public static AlterIndexStep alterIndex(Name index) {
+ return using(new DefaultConfiguration()).alterIndex(index);
+ }
+
/**
* Create a new DSL DROP VIEW statement.
*
diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
index cf004c34b3..96c9adacaa 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DefaultDSLContext.java
@@ -79,6 +79,7 @@ import java.util.stream.Stream;
import javax.annotation.Generated;
import javax.sql.DataSource;
+import org.jooq.AlterIndexStep;
import org.jooq.AlterSequenceStep;
import org.jooq.AlterTableStep;
import org.jooq.AlterViewStep;
@@ -2555,6 +2556,16 @@ public class DefaultDSLContext extends AbstractScope implements DSLContext, Seri
return new AlterViewImpl(configuration(), table);
}
+ @Override
+ public AlterIndexStep alterIndex(String index) {
+ return alterIndex(name(index));
+ }
+
+ @Override
+ public AlterIndexStep alterIndex(Name index) {
+ return new AlterIndexImpl(configuration(), index);
+ }
+
@Override
public DropViewFinalStep dropView(String view) {
return dropView(name(view));