diff --git a/jOOQ/src/main/java/org/jooq/SQLDialect.java b/jOOQ/src/main/java/org/jooq/SQLDialect.java index 489e84f2dc..e995ce82f9 100644 --- a/jOOQ/src/main/java/org/jooq/SQLDialect.java +++ b/jOOQ/src/main/java/org/jooq/SQLDialect.java @@ -1209,6 +1209,46 @@ public enum SQLDialect { return other.predecessors().contains(this); } + /** + * Whether this dialect strictly precedes an other dialect from the same + * family. + *

+ * This returns: + *

+ * The above also implies that: + * + *

+ * This is useful to see if some feature is supported by "at least" + * a given dialect version. Example: + * + *

+     * 
+     * // Do this block only if the chosen dialect was before PostgreSQL 9.3-
+     * if (dialect.precedesStrictly(POSTGRES_9_3)) {
+     * }
+     *
+     * // Do this block only if the chosen dialect was before PostgreSQL 9.4-
+     * else if (dialect.precedesStrictly(POSTGRES_9_4)) {
+     * }
+     *
+     * // Fall back to post-PostgreSQL 9.4+ behaviour
+     * else {
+     * }
+     * 
+     * 
+ */ + public final boolean precedesStrictly(SQLDialect other) { + return precedes(other) && this != other; + } + /** * Check whether this dialect supports another one. *