From 474657a44b06fb091e45e2cda8e2d1b443560f27 Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 23 Jun 2020 11:50:29 +0200 Subject: [PATCH] [jOOQ/jOOQ#10128] Add support for Postgres 12 materialized CTEs --- .../main/java/org/jooq/DerivedColumnList.java | 29 +++++++++-- .../java/org/jooq/DerivedColumnList1.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList10.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList11.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList12.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList13.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList14.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList15.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList16.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList17.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList18.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList19.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList2.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList20.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList21.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList22.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList3.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList4.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList5.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList6.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList7.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList8.java | 24 ++++++++++ .../java/org/jooq/DerivedColumnList9.java | 24 ++++++++++ jOOQ/src/main/java/org/jooq/Name.java | 30 ++++++++++++ jOOQ/src/main/java/org/jooq/WithAsStep.java | 33 +++++++++++-- jOOQ/src/main/java/org/jooq/WithAsStep1.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep10.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep11.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep12.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep13.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep14.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep15.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep16.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep17.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep18.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep19.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep2.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep20.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep21.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep22.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep3.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep4.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep5.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep6.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep7.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep8.java | 27 ++++++++++- jOOQ/src/main/java/org/jooq/WithAsStep9.java | 27 ++++++++++- .../main/java/org/jooq/impl/AbstractName.java | 12 +++++ .../jooq/impl/CommonTableExpressionImpl.java | 48 +++++++++++++++++-- .../org/jooq/impl/DerivedColumnListImpl.java | 26 ++++++++-- .../src/main/java/org/jooq/impl/Keywords.java | 3 ++ .../main/java/org/jooq/impl/ParserImpl.java | 19 ++++++-- .../java/org/jooq/impl/SelectQueryImpl.java | 9 ++++ jOOQ/src/main/java/org/jooq/impl/Tools.java | 6 +++ .../src/main/java/org/jooq/impl/WithImpl.java | 42 ++++++++++++---- pom.xml | 10 +++- 56 files changed, 1337 insertions(+), 52 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList.java index eec93e1989..13e45508a6 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList.java @@ -37,9 +37,6 @@ */ package org.jooq; -import org.jetbrains.annotations.*; - - // ... // ... // ... @@ -57,6 +54,8 @@ import static org.jooq.SQLDialect.SQLITE; // ... // ... +import org.jetbrains.annotations.NotNull; + /** * A derived column list. *

@@ -92,4 +91,28 @@ public interface DerivedColumnList extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList1.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList1.java index f063360860..2e9becc747 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList1.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList1.java @@ -93,4 +93,28 @@ public interface DerivedColumnList1 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList10.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList10.java index 1d81e14def..b095ee14f7 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList10.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList10.java @@ -93,4 +93,28 @@ public interface DerivedColumnList10 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList11.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList11.java index 8529832593..fdca75ec26 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList11.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList11.java @@ -93,4 +93,28 @@ public interface DerivedColumnList11 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList12.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList12.java index 2c563149a6..022b8f4163 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList12.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList12.java @@ -93,4 +93,28 @@ public interface DerivedColumnList12 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList13.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList13.java index 7fce358d67..a4c3f2683f 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList13.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList13.java @@ -93,4 +93,28 @@ public interface DerivedColumnList13 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList14.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList14.java index 5e3f5c5991..a73f9660b9 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList14.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList14.java @@ -93,4 +93,28 @@ public interface DerivedColumnList14 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList15.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList15.java index 1554133fe2..6ba7d15149 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList15.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList15.java @@ -93,4 +93,28 @@ public interface DerivedColumnList15 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList16.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList16.java index 67fdaa3605..3c5dfd8806 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList16.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList16.java @@ -93,4 +93,28 @@ public interface DerivedColumnList16 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList17.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList17.java index d515dc058f..c3b2e3719e 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList17.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList17.java @@ -93,4 +93,28 @@ public interface DerivedColumnList17 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList18.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList18.java index 57a712dfb9..b6d68cdd27 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList18.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList18.java @@ -93,4 +93,28 @@ public interface DerivedColumnList18 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList19.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList19.java index 3ac1bad4a5..1aba23146b 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList19.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList19.java @@ -93,4 +93,28 @@ public interface DerivedColumnList19 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList2.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList2.java index e0e678ae97..2012018187 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList2.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList2.java @@ -93,4 +93,28 @@ public interface DerivedColumnList2 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList20.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList20.java index 8b212d59ba..0f9d0ee87f 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList20.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList20.java @@ -93,4 +93,28 @@ public interface DerivedColumnList20 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList21.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList21.java index 970ada1595..f212bfa73a 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList21.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList21.java @@ -93,4 +93,28 @@ public interface DerivedColumnList21 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList22.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList22.java index de38c89eb0..b2027b38fb 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList22.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList22.java @@ -93,4 +93,28 @@ public interface DerivedColumnList22 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList3.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList3.java index a55a3bfda4..9d92b5d86f 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList3.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList3.java @@ -93,4 +93,28 @@ public interface DerivedColumnList3 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList4.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList4.java index fd6c484921..cfa736b5cb 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList4.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList4.java @@ -93,4 +93,28 @@ public interface DerivedColumnList4 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList5.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList5.java index 962ac85f6a..2578b56f12 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList5.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList5.java @@ -93,4 +93,28 @@ public interface DerivedColumnList5 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList6.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList6.java index 223b496a52..d44846ac6b 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList6.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList6.java @@ -93,4 +93,28 @@ public interface DerivedColumnList6 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList7.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList7.java index 4905c271f0..5288de10d2 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList7.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList7.java @@ -93,4 +93,28 @@ public interface DerivedColumnList7 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList8.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList8.java index d5a8e266c8..4e9767b3c5 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList8.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList8.java @@ -93,4 +93,28 @@ public interface DerivedColumnList8 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/DerivedColumnList9.java b/jOOQ/src/main/java/org/jooq/DerivedColumnList9.java index 3a9ac58dd8..7841c59013 100644 --- a/jOOQ/src/main/java/org/jooq/DerivedColumnList9.java +++ b/jOOQ/src/main/java/org/jooq/DerivedColumnList9.java @@ -93,4 +93,28 @@ public interface DerivedColumnList9 extends QueryPart { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) > CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the + * DerivedColumnList to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + > CommonTableExpression asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/Name.java b/jOOQ/src/main/java/org/jooq/Name.java index fba16052db..800a2ed925 100644 --- a/jOOQ/src/main/java/org/jooq/Name.java +++ b/jOOQ/src/main/java/org/jooq/Name.java @@ -249,6 +249,36 @@ public interface Name extends QueryPart, Comparable { @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) CommonTableExpression as(Select select); + /** + * Specify a materialized subselect to refer to by the Name to + * form a common table expression. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + *

+ * Column names are implicitly inherited from the SELECT + * statement. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + CommonTableExpression asMaterialized(Select select); + + /** + * Specify a non-materialized subselect to refer to by the Name + * to form a common table expression. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + *

+ * Column names are implicitly inherited from the SELECT + * statement. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + CommonTableExpression asNotMaterialized(Select select); + /** * Add a list of fields to this name to make this name a * {@link DerivedColumnList}. diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep.java b/jOOQ/src/main/java/org/jooq/WithAsStep.java index 82abe0fd02..eba313426c 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep.java @@ -37,9 +37,6 @@ */ package org.jooq; -import org.jetbrains.annotations.*; - - // ... // ... // ... @@ -59,6 +56,8 @@ import static org.jooq.SQLDialect.SQLITE; // ... // ... +import org.jetbrains.annotations.NotNull; + /** * This type is part of the jOOQ DSL to create {@link Select}, {@link Insert}, * {@link Update}, {@link Delete}, {@link Merge} statements prefixed with a @@ -97,9 +96,35 @@ import static org.jooq.SQLDialect.SQLITE; public interface WithAsStep { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select select); + } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep1.java b/jOOQ/src/main/java/org/jooq/WithAsStep1.java index 51af8798bf..f4ed31592f 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep1.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep1.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep1 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep10.java b/jOOQ/src/main/java/org/jooq/WithAsStep10.java index 2c10dc3477..19927f1d5f 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep10.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep10.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep10 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep11.java b/jOOQ/src/main/java/org/jooq/WithAsStep11.java index 1d6a3e0f00..493c12bdf5 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep11.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep11.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep11 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep12.java b/jOOQ/src/main/java/org/jooq/WithAsStep12.java index c4a4347092..511af75420 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep12.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep12.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep12 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep13.java b/jOOQ/src/main/java/org/jooq/WithAsStep13.java index 066edbf9b0..b15145193c 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep13.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep13.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep13 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep14.java b/jOOQ/src/main/java/org/jooq/WithAsStep14.java index e5f21c7b89..9e03914b41 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep14.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep14.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep14 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep15.java b/jOOQ/src/main/java/org/jooq/WithAsStep15.java index 9c7a5cced1..bf19c3aff2 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep15.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep15.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep15 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep16.java b/jOOQ/src/main/java/org/jooq/WithAsStep16.java index b536ecdf0b..17dad8c1a0 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep16.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep16.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep16 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep17.java b/jOOQ/src/main/java/org/jooq/WithAsStep17.java index aac4881553..7ce2af087a 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep17.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep17.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep17 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep18.java b/jOOQ/src/main/java/org/jooq/WithAsStep18.java index dee8e141b4..d157db0169 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep18.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep18.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep18 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep19.java b/jOOQ/src/main/java/org/jooq/WithAsStep19.java index 4105a80270..922b23d591 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep19.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep19.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep19 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep2.java b/jOOQ/src/main/java/org/jooq/WithAsStep2.java index 8d966df50d..b29e879fdb 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep2.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep2.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep2 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep20.java b/jOOQ/src/main/java/org/jooq/WithAsStep20.java index 84c616c705..832482482c 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep20.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep20.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep20 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep21.java b/jOOQ/src/main/java/org/jooq/WithAsStep21.java index 0d8f9f0def..206f07b28e 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep21.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep21.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep21 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep22.java b/jOOQ/src/main/java/org/jooq/WithAsStep22.java index 026e4807f4..90cdfc1c67 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep22.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep22.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep22 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep3.java b/jOOQ/src/main/java/org/jooq/WithAsStep3.java index 699e591ff6..6513fee118 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep3.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep3.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep3 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep4.java b/jOOQ/src/main/java/org/jooq/WithAsStep4.java index f2ed2cffc2..fe0c26c629 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep4.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep4.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep4 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep5.java b/jOOQ/src/main/java/org/jooq/WithAsStep5.java index 0131e60ecb..6d7721b0d4 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep5.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep5.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep5 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep6.java b/jOOQ/src/main/java/org/jooq/WithAsStep6.java index 5a4d5c4c05..cb9ceb4f74 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep6.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep6.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep6 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep7.java b/jOOQ/src/main/java/org/jooq/WithAsStep7.java index 195d259037..7c144a10d5 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep7.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep7.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep7 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep8.java b/jOOQ/src/main/java/org/jooq/WithAsStep8.java index 8e65243f4b..6f85b5c8f7 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep8.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep8.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep8 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/WithAsStep9.java b/jOOQ/src/main/java/org/jooq/WithAsStep9.java index f3a34be75b..09b7b96f9b 100644 --- a/jOOQ/src/main/java/org/jooq/WithAsStep9.java +++ b/jOOQ/src/main/java/org/jooq/WithAsStep9.java @@ -78,9 +78,34 @@ import org.jetbrains.annotations.NotNull; public interface WithAsStep9 { /** - * Associate a subselect with a common table expression's table and column names. + * Associate a subselect with a common table expression's table and column + * names. */ @NotNull @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) WithStep as(Select> select); + + /** + * Associate a materialized subselect with a common table expression's table + * and column names. + *

+ * This adds the PostgreSQL 12 MATERIALIZED hint to the common + * table expression definition, or silently ignores it, if the hint is not + * supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asMaterialized(Select> select); + + /** + * Associate a non-materialized subselect with a common table expression's + * table and column names. + *

+ * This adds the PostgreSQL 12 NOT MATERIALIZED hint to the + * common table expression definition, or silently ignores it, if the hint + * is not supported. + */ + @NotNull + @Support({ FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES, SQLITE }) + WithStep asNotMaterialized(Select> select); } diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractName.java b/jOOQ/src/main/java/org/jooq/impl/AbstractName.java index 620ccb1670..28eb567a48 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractName.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractName.java @@ -98,6 +98,18 @@ abstract class AbstractName extends AbstractQueryPart implements Name { return fields(new String[0]).as(select); } + @SuppressWarnings("unchecked") + @Override + public final CommonTableExpression asMaterialized(Select select) { + return fields(new String[0]).asMaterialized(select); + } + + @SuppressWarnings("unchecked") + @Override + public final CommonTableExpression asNotMaterialized(Select select) { + return fields(new String[0]).asNotMaterialized(select); + } + @Override public final DerivedColumnListImpl fields(String... fieldNames) { return fields(Tools.names(fieldNames)); diff --git a/jOOQ/src/main/java/org/jooq/impl/CommonTableExpressionImpl.java b/jOOQ/src/main/java/org/jooq/impl/CommonTableExpressionImpl.java index 4c92e9af03..c9787cbc05 100644 --- a/jOOQ/src/main/java/org/jooq/impl/CommonTableExpressionImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/CommonTableExpressionImpl.java @@ -37,17 +37,25 @@ */ package org.jooq.impl; +// ... +import static org.jooq.SQLDialect.POSTGRES; import static org.jooq.impl.Keywords.K_AS; +import static org.jooq.impl.Keywords.K_MATERIALIZED; +import static org.jooq.impl.Keywords.K_NOT; import static org.jooq.impl.Tools.visitSubquery; import java.util.List; +import java.util.Set; import org.jooq.CommonTableExpression; import org.jooq.Context; import org.jooq.Field; +// ... import org.jooq.Record; +import org.jooq.SQLDialect; import org.jooq.Select; import org.jooq.TableOptions; +import org.jooq.impl.Tools.DataKey; /** * @author Lukas Eder @@ -57,18 +65,26 @@ final class CommonTableExpressionImpl extends AbstractTable /** * Generated UID */ - private static final long serialVersionUID = 2520235151216758958L; + private static final long serialVersionUID = 2520235151216758958L; - private final DerivedColumnListImpl name; - private final Select select; - private final Fields fields; + private static final Set SUPPORT_MATERIALIZED = SQLDialect.supportedBy(POSTGRES); - CommonTableExpressionImpl(DerivedColumnListImpl name, Select select) { + + + + + private final DerivedColumnListImpl name; + private final Select select; + private final Fields fields; + private final Boolean materialized; + + CommonTableExpressionImpl(DerivedColumnListImpl name, Select select, Boolean materialized) { super(TableOptions.expression(), name.name); this.name = name; this.select = select; this.fields = fields1(); + this.materialized = materialized; } @Override @@ -85,7 +101,29 @@ final class CommonTableExpressionImpl extends AbstractTable public final void accept(Context ctx) { if (ctx.declareCTE()) { ctx.visit(name).sql(' ').visit(K_AS).sql(' '); + + Object previous = null; + if (materialized != null) { + if (SUPPORT_MATERIALIZED.contains(ctx.family())) { + if (materialized) + ctx.visit(K_MATERIALIZED).sql(' '); + else + ctx.visit(K_NOT).sql(' ').visit(K_MATERIALIZED).sql(' '); + } + + + + + + } + visitSubquery(ctx, select, true); + + + + + + } else ctx.visit(DSL.name(name.name)); diff --git a/jOOQ/src/main/java/org/jooq/impl/DerivedColumnListImpl.java b/jOOQ/src/main/java/org/jooq/impl/DerivedColumnListImpl.java index d93b99bf3d..6ea28cf491 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DerivedColumnListImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/DerivedColumnListImpl.java @@ -72,6 +72,7 @@ import org.jooq.Select; /** * @author Lukas Eder */ +@SuppressWarnings({ "unchecked", "rawtypes" }) final class DerivedColumnListImpl extends AbstractQueryPart implements @@ -130,22 +131,37 @@ implements } - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public final CommonTableExpression as(Select select) { + final CommonTableExpression as0(Select select, Boolean materialized) { Select s = select; if (fieldNameFunction != null) { List> source = s.getSelect(); Name[] names = new Name[source.size()]; + for (int i = 0; i < names.length; i++) names[i] = DSL.name(fieldNameFunction.apply(source.get(i), i)); - return new CommonTableExpressionImpl(new DerivedColumnListImpl(name, names), s); + + return new CommonTableExpressionImpl(new DerivedColumnListImpl(name, names), s, materialized); } - return new CommonTableExpressionImpl(this, s); + return new CommonTableExpressionImpl(this, s, materialized); + } + + @Override + public final CommonTableExpression as(Select select) { + return as0(select, null); + } + + @Override + public final CommonTableExpression asMaterialized(Select select) { + return as0(select, true); + } + + @Override + public final CommonTableExpression asNotMaterialized(Select select) { + return as0(select, false); } @Override diff --git a/jOOQ/src/main/java/org/jooq/impl/Keywords.java b/jOOQ/src/main/java/org/jooq/impl/Keywords.java index 34f4c2083f..e93f714743 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Keywords.java +++ b/jOOQ/src/main/java/org/jooq/impl/Keywords.java @@ -205,6 +205,7 @@ final class Keywords { static final Keyword K_INCLUDE_NULL_VALUES = keyword("include_null_values"); static final Keyword K_INCREMENT_BY = keyword("increment by"); static final Keyword K_INDEX = keyword("index"); + static final Keyword K_INLINE = keyword("inline"); static final Keyword K_INNER_JOIN = keyword("inner join"); static final Keyword K_INSERT = keyword("insert"); static final Keyword K_INT = keyword("int"); @@ -238,6 +239,8 @@ final class Keywords { static final Keyword K_LOCK_IN_SHARE_MODE = keyword("lock in share mode"); static final Keyword K_LOOP = keyword("loop"); static final Keyword K_MATCHED = keyword("matched"); + static final Keyword K_MATERIALIZE = keyword("materialize"); + static final Keyword K_MATERIALIZED = keyword("materialized"); static final Keyword K_MAXVALUE = keyword("maxvalue"); static final Keyword K_MERGE_INTO = keyword("merge into"); static final Keyword K_MILLISECOND = keyword("millisecond"); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index ca21b798c8..3dbb80af68 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -1060,21 +1060,34 @@ final class ParserImpl implements Parser { List> cte = new ArrayList<>(); do { - Name table = parseIdentifier(ctx); + Name name = parseIdentifier(ctx); DerivedColumnList dcl = null; if (parseIf(ctx, '(')) { List columnNames = parseIdentifiers(ctx); parse(ctx, ')'); - dcl = table.fields(columnNames.toArray(EMPTY_NAME)); + dcl = name.fields(columnNames.toArray(EMPTY_NAME)); } parseKeyword(ctx, "AS"); + boolean materialized = parseKeywordIf(ctx, "MATERIALIZED"); + boolean notMaterialized = !materialized && parseKeywordIf(ctx, "NOT MATERIALIZED"); parse(ctx, '('); Select select = parseSelect(ctx); parse(ctx, ')'); - cte.add(dcl != null ? dcl.as(select) : table.as(select)); + cte.add(dcl != null + ? materialized + ? dcl.asMaterialized(select) + : notMaterialized + ? dcl.asNotMaterialized(select) + : dcl.as(select) + : materialized + ? name.asMaterialized(select) + : notMaterialized + ? name.asNotMaterialized(select) + : name.as(select) + ); } while (parseIf(ctx, ',')); diff --git a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java index 98cac271d4..3e524a6dbb 100644 --- a/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/SelectQueryImpl.java @@ -125,7 +125,9 @@ import static org.jooq.impl.Keywords.K_DISTINCT_ON; import static org.jooq.impl.Keywords.K_FROM; import static org.jooq.impl.Keywords.K_GROUP_BY; import static org.jooq.impl.Keywords.K_HAVING; +import static org.jooq.impl.Keywords.K_INLINE; import static org.jooq.impl.Keywords.K_INTO; +import static org.jooq.impl.Keywords.K_MATERIALIZE; import static org.jooq.impl.Keywords.K_NOCYCLE; import static org.jooq.impl.Keywords.K_ORDER; import static org.jooq.impl.Keywords.K_ORDER_BY; @@ -1544,6 +1546,13 @@ final class SelectQueryImpl extends AbstractResultQuery imp + + + + + + + if (Tools.isNotEmpty(distinctOn)) context.visit(K_DISTINCT_ON).sql(" (").visit(distinctOn).sql(')').separatorRequired(true); else if (distinct) diff --git a/jOOQ/src/main/java/org/jooq/impl/Tools.java b/jOOQ/src/main/java/org/jooq/impl/Tools.java index 3fe4bf1bb7..5c2b8f2d28 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Tools.java +++ b/jOOQ/src/main/java/org/jooq/impl/Tools.java @@ -582,6 +582,12 @@ final class Tools { + + + + + + diff --git a/jOOQ/src/main/java/org/jooq/impl/WithImpl.java b/jOOQ/src/main/java/org/jooq/impl/WithImpl.java index c94714e088..8d464b8d45 100644 --- a/jOOQ/src/main/java/org/jooq/impl/WithImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/WithImpl.java @@ -60,6 +60,7 @@ import org.jooq.Clause; import org.jooq.CommonTableExpression; import org.jooq.Configuration; import org.jooq.Context; +import org.jooq.DerivedColumnList; import org.jooq.Field; import org.jooq.InsertSetStep; import org.jooq.MergeUsingStep; @@ -172,7 +173,7 @@ implements - private final CommonTableExpressionList cte; + private final CommonTableExpressionList ctes; private final boolean recursive; private Configuration configuration; @@ -187,7 +188,7 @@ implements WithImpl(Configuration configuration, boolean recursive) { this.configuration = configuration; this.recursive = recursive; - this.cte = new CommonTableExpressionList(); + this.ctes = new CommonTableExpressionList(); } // ------------------------------------------------------------------------- @@ -207,7 +208,7 @@ implements ctx.visit(K_RECURSIVE) .separatorRequired(true); - CommonTableExpressionList c = cte; + CommonTableExpressionList c = ctes; @@ -234,16 +235,26 @@ implements // XXX With API // ------------------------------------------------------------------------- - @Override - public final WithStep as(Select select) { + private final WithStep as0(Select select, Boolean materialized) { + DerivedColumnList dcl; if (fieldNameFunction != null) - cte.add(name(alias).fields(fieldNameFunction).as(select)); + dcl = name(alias).fields(fieldNameFunction); else - cte.add(name(alias).fields(fieldAliases).as(select)); + dcl = name(alias).fields(fieldAliases); + CommonTableExpression cte; + + if (materialized == null) + cte = dcl.as(select); + else if (materialized) + cte = dcl.asMaterialized(select); + else + cte = dcl.asNotMaterialized(select); + + this.ctes.add(cte); this.alias = null; this.fieldAliases = null; @@ -253,6 +264,21 @@ implements return this; } + @Override + public final WithStep as(Select select) { + return as0(select, null); + } + + @Override + public final WithStep asMaterialized(Select select) { + return as0(select, true); + } + + @Override + public final WithStep asNotMaterialized(Select select) { + return as0(select, false); + } + @Override public final WithImpl with(String a) { return with(DSL.name(a)); @@ -536,7 +562,7 @@ implements @Override public final WithStep with(Collection> tables) { for (CommonTableExpression table : tables) - cte.add(table); + ctes.add(table); return this; } diff --git a/pom.xml b/pom.xml index ed12fefdf3..14741b1ec8 100644 --- a/pom.xml +++ b/pom.xml @@ -167,7 +167,7 @@ org.eclipse.xtend org.eclipse.xtend.lib - 2.20.0 + 2.22.0 @@ -538,7 +538,7 @@ org.eclipse.xtend xtend-maven-plugin - 2.20.0 + 2.22.0 UTF-8 @@ -549,6 +549,12 @@ org.apache.maven.plugins maven-surefire-plugin 2.22.2 + + + + --illegal-access=deny + +