diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java
index 920dd2ad87..86fbd3ff62 100644
--- a/jOOQ/src/main/java/org/jooq/conf/Settings.java
+++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java
@@ -121,6 +121,10 @@ public class Settings
protected Boolean transformPatternsNegNeg = true;
@XmlElement(defaultValue = "true")
protected Boolean transformPatternsBitNotBitNot = true;
+ @XmlElement(defaultValue = "true")
+ protected Boolean transformPatternsNotNotDistinct = true;
+ @XmlElement(defaultValue = "true")
+ protected Boolean transformPatternsIdempotentFunctionRepetition = true;
@XmlElement(defaultValue = "false")
protected Boolean transformAnsiJoinToTableLists = false;
@XmlElement(defaultValue = "WHEN_NEEDED")
@@ -1183,9 +1187,7 @@ public class Settings
/**
* Transform NOT(NOT(x)) to x
*
- * For various reasons, there may be a redundant nesting of NOT unary operators, e.g. as a
- * left over of some prior transformation, including manual ones. This transformation will simplify such
- * redundant negations by removing them.
+ * This transformation removes a redundant logic negation.
*
* To enable this feature, {@link #transformPatterns} must be enabled as well. *
@@ -1215,9 +1217,7 @@ public class Settings
/**
* Transform -(-(x)) to x
*
- * For various reasons, there may be a redundant nesting of - unary operators, e.g. as a
- * left over of some prior transformation, including manual ones. This transformation will simplify such
- * redundant negations by removing them.
+ * This transformation removes a redundant arithmetic negation.
*
* To enable this feature, {@link #transformPatterns} must be enabled as well. *
@@ -1245,11 +1245,9 @@ public class Settings
}
/**
- * Transform ~(~(x)) to x
+ * Transform ~(~(x)) to x.
*
- * For various reasons, there may be a redundant nesting of ~ unary operators, e.g. as a
- * left over of some prior transformation, including manual ones. This transformation will simplify such
- * redundant negations by removing them.
+ * This transformation removes a redundant bitwise negation.
*
* To enable this feature, {@link #transformPatterns} must be enabled as well. *
@@ -1276,6 +1274,72 @@ public class Settings
this.transformPatternsBitNotBitNot = value;
}
+ /**
+ * Transform NOT (a IS NOT DISTINCT FROM b) to a IS DISTINCT FROM b
+ *
+ * This transformation removes a redundant logical negation from the DISTINCT predicate.
+ *
+ * This feature is available in the commercial distribution only.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isTransformPatternsNotNotDistinct() {
+ return transformPatternsNotNotDistinct;
+ }
+
+ /**
+ * Sets the value of the transformPatternsNotNotDistinct property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setTransformPatternsNotNotDistinct(Boolean value) {
+ this.transformPatternsNotNotDistinct = value;
+ }
+
+ /**
+ * Transform all repetitions of idempotent functions, such as UPPER(UPPER(s)) to UPPER(s)
+ *
+ * Idempotent functions that are covered so far, include: + *
LTRIM(LTRIM(s)) to LTRIM(s)LTRIM(TRIM(s)) to TRIM(s)RTRIM(RTRIM(s)) to RTRIM(s)RTRIM(TRIM(s)) to TRIM(s)TRIM(LTRIM(s)) to TRIM(s)TRIM(RTRIM(s)) to TRIM(s)UPPER(UPPER(s)) to UPPER(s)LOWER(LOWER(s)) to LOWER(s)+ * This feature is available in the commercial distribution only. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isTransformPatternsIdempotentFunctionRepetition() { + return transformPatternsIdempotentFunctionRepetition; + } + + /** + * Sets the value of the transformPatternsIdempotentFunctionRepetition property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setTransformPatternsIdempotentFunctionRepetition(Boolean value) { + this.transformPatternsIdempotentFunctionRepetition = value; + } + /** * Transform ANSI join to table lists if possible. *
@@ -3537,6 +3601,16 @@ public class Settings
return this;
}
+ public Settings withTransformPatternsNotNotDistinct(Boolean value) {
+ setTransformPatternsNotNotDistinct(value);
+ return this;
+ }
+
+ public Settings withTransformPatternsIdempotentFunctionRepetition(Boolean value) {
+ setTransformPatternsIdempotentFunctionRepetition(value);
+ return this;
+ }
+
public Settings withTransformAnsiJoinToTableLists(Boolean value) {
setTransformAnsiJoinToTableLists(value);
return this;
@@ -4365,6 +4439,8 @@ public class Settings
builder.append("transformPatternsNotNot", transformPatternsNotNot);
builder.append("transformPatternsNegNeg", transformPatternsNegNeg);
builder.append("transformPatternsBitNotBitNot", transformPatternsBitNotBitNot);
+ builder.append("transformPatternsNotNotDistinct", transformPatternsNotNotDistinct);
+ builder.append("transformPatternsIdempotentFunctionRepetition", transformPatternsIdempotentFunctionRepetition);
builder.append("transformAnsiJoinToTableLists", transformAnsiJoinToTableLists);
builder.append("transformInConditionSubqueryWithLimitToDerivedTable", transformInConditionSubqueryWithLimitToDerivedTable);
builder.append("transformQualify", transformQualify);
@@ -4805,6 +4881,24 @@ public class Settings
return false;
}
}
+ if (transformPatternsNotNotDistinct == null) {
+ if (other.transformPatternsNotNotDistinct!= null) {
+ return false;
+ }
+ } else {
+ if (!transformPatternsNotNotDistinct.equals(other.transformPatternsNotNotDistinct)) {
+ return false;
+ }
+ }
+ if (transformPatternsIdempotentFunctionRepetition == null) {
+ if (other.transformPatternsIdempotentFunctionRepetition!= null) {
+ return false;
+ }
+ } else {
+ if (!transformPatternsIdempotentFunctionRepetition.equals(other.transformPatternsIdempotentFunctionRepetition)) {
+ return false;
+ }
+ }
if (transformAnsiJoinToTableLists == null) {
if (other.transformAnsiJoinToTableLists!= null) {
return false;
@@ -5703,6 +5797,8 @@ public class Settings
result = ((prime*result)+((transformPatternsNotNot == null)? 0 :transformPatternsNotNot.hashCode()));
result = ((prime*result)+((transformPatternsNegNeg == null)? 0 :transformPatternsNegNeg.hashCode()));
result = ((prime*result)+((transformPatternsBitNotBitNot == null)? 0 :transformPatternsBitNotBitNot.hashCode()));
+ result = ((prime*result)+((transformPatternsNotNotDistinct == null)? 0 :transformPatternsNotNotDistinct.hashCode()));
+ result = ((prime*result)+((transformPatternsIdempotentFunctionRepetition == null)? 0 :transformPatternsIdempotentFunctionRepetition.hashCode()));
result = ((prime*result)+((transformAnsiJoinToTableLists == null)? 0 :transformAnsiJoinToTableLists.hashCode()));
result = ((prime*result)+((transformInConditionSubqueryWithLimitToDerivedTable == null)? 0 :transformInConditionSubqueryWithLimitToDerivedTable.hashCode()));
result = ((prime*result)+((transformQualify == null)? 0 :transformQualify.hashCode()));
diff --git a/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java b/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java
index 39494ac294..f2b19e7546 100644
--- a/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java
+++ b/jOOQ/src/main/java/org/jooq/impl/DefaultRenderContext.java
@@ -84,10 +84,13 @@ import org.jooq.conf.SettingsTools;
import org.jooq.exception.ControlFlowSignal;
import org.jooq.exception.DataAccessException;
import org.jooq.impl.QOM.BitNot;
+import org.jooq.impl.QOM.IsNotDistinctFrom;
import org.jooq.impl.QOM.Ltrim;
import org.jooq.impl.QOM.Neg;
import org.jooq.impl.QOM.Not;
import org.jooq.impl.QOM.Rtrim;
+import org.jooq.impl.QOM.Trim;
+import org.jooq.impl.QOM.Upper;
import org.jooq.impl.ScopeMarker.ScopeContent;
import org.jooq.tools.JooqLogger;
import org.jooq.tools.StringUtils;
@@ -713,10 +716,11 @@ class DefaultRenderContext extends AbstractContext
-For various reasons, there may be a redundant nesting of
To enable this feature, {@link #transformPatterns} must be enabled as well.
@@ -307,9 +305,7 @@ This feature is available in the commercial distribution only.]]>
-For various reasons, there may be a redundant nesting of
To enable this feature, {@link #transformPatterns} must be enabled as well.
@@ -317,17 +313,41 @@ This feature is available in the commercial distribution only.]]>
-For various reasons, there may be a redundant nesting of
To enable this feature, {@link #transformPatterns} must be enabled as well.
This feature is available in the commercial distribution only.]]>
+This transformation removes a redundant logical negation from the
+This feature is available in the commercial distribution only.]]>
+Idempotent functions that are covered so far, include:
+
+This feature is available in the commercial distribution only.]]>x
NOT unary operators, e.g. as a
-left over of some prior transformation, including manual ones. This transformation will simplify such
-redundant negations by removing them.
+This transformation removes a redundant logic negation.
x
- unary operators, e.g. as a
-left over of some prior transformation, including manual ones. This transformation will simplify such
-redundant negations by removing them.
+This transformation removes a redundant arithmetic negation.
x
+ x.
~ unary operators, e.g. as a
-left over of some prior transformation, including manual ones. This transformation will simplify such
-redundant negations by removing them.
+This transformation removes a redundant bitwise negation.
a IS DISTINCT FROM b
+DISTINCT predicate.
+UPPER(s)
+
+
+LTRIM(LTRIM(s)) to LTRIM(s)LTRIM(TRIM(s)) to TRIM(s)RTRIM(RTRIM(s)) to RTRIM(s)RTRIM(TRIM(s)) to TRIM(s)TRIM(LTRIM(s)) to TRIM(s)TRIM(RTRIM(s)) to TRIM(s)UPPER(UPPER(s)) to UPPER(s)LOWER(LOWER(s)) to LOWER(s)