From ead3073334d0e7d4d2c75794d783c93d8f0893fe Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Tue, 2 Apr 2024 12:39:20 +0200 Subject: [PATCH] [jOOQ/jOOQ#7539] Support computed columns --- jOOQ/src/main/java/org/jooq/DataType.java | 10 +++++----- jOOQ/src/main/java/org/jooq/impl/ParserImpl.java | 16 ++++++++++++++++ jOOQ/src/main/java/org/jooq/impl/Tools.java | 9 +++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/jOOQ/src/main/java/org/jooq/DataType.java b/jOOQ/src/main/java/org/jooq/DataType.java index 35d6b67b2e..08d6f657c2 100644 --- a/jOOQ/src/main/java/org/jooq/DataType.java +++ b/jOOQ/src/main/java/org/jooq/DataType.java @@ -799,7 +799,7 @@ public interface DataType extends Named { * This feature is implemented in commercial distributions only. */ @NotNull - @Support({ DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + @Support({ CLICKHOUSE, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) DataType generatedAlwaysAs(T generatedAlwaysAsValue); /** @@ -811,7 +811,7 @@ public interface DataType extends Named { * This feature is implemented in commercial distributions only. */ @NotNull - @Support({ DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + @Support({ CLICKHOUSE, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) DataType generatedAlwaysAs(Field generatedAlwaysAsValue); /** @@ -867,7 +867,7 @@ public interface DataType extends Named { * This feature is implemented in commercial distributions only. */ @NotNull - @Support({ DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + @Support({ CLICKHOUSE, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) DataType stored(); /** @@ -879,7 +879,7 @@ public interface DataType extends Named { * This feature is implemented in commercial distributions only. */ @NotNull - @Support({ DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + @Support({ CLICKHOUSE, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) DataType virtual(); /** @@ -890,7 +890,7 @@ public interface DataType extends Named { * This feature is implemented in commercial distributions only. */ @NotNull - @Support({ DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) + @Support({ CLICKHOUSE, DERBY, DUCKDB, FIREBIRD, H2, HSQLDB, MARIADB, MYSQL, POSTGRES }) DataType generationOption(GenerationOption generationOption); /** diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index 67cce50b81..53c27e814e 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -4990,6 +4990,22 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { + } + else if (!computed && !ignoreProEdition() && parseKeywordIf("ALIAS") && requireProEdition()) { + + + + + + + } + else if (!computed && !ignoreProEdition() && parseKeywordIf("MATERIALIZED") && requireProEdition()) { + + + + + + } else if ((!identity || !computed) && parseKeywordIf("GENERATED")) { boolean always; diff --git a/jOOQ/src/main/java/org/jooq/impl/Tools.java b/jOOQ/src/main/java/org/jooq/impl/Tools.java index 32b6c2e277..ff2c486ff2 100644 --- a/jOOQ/src/main/java/org/jooq/impl/Tools.java +++ b/jOOQ/src/main/java/org/jooq/impl/Tools.java @@ -141,6 +141,7 @@ import static org.jooq.impl.Identifiers.QUOTES; import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER; import static org.jooq.impl.Identifiers.QUOTE_END_DELIMITER_ESCAPED; import static org.jooq.impl.Identifiers.QUOTE_START_DELIMITER; +import static org.jooq.impl.Keywords.K_ALIAS; import static org.jooq.impl.Keywords.K_ALWAYS; import static org.jooq.impl.Keywords.K_AS; import static org.jooq.impl.Keywords.K_ATOMIC; @@ -176,6 +177,7 @@ import static org.jooq.impl.Keywords.K_IMPLICITLY; import static org.jooq.impl.Keywords.K_INT; import static org.jooq.impl.Keywords.K_INVISIBLE; import static org.jooq.impl.Keywords.K_LIKE; +import static org.jooq.impl.Keywords.K_MATERIALIZED; import static org.jooq.impl.Keywords.K_NOT; import static org.jooq.impl.Keywords.K_NOT_NULL; import static org.jooq.impl.Keywords.K_NULL; @@ -6129,6 +6131,13 @@ final class Tools { + + + + + + +