diff --git a/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java b/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java index 195a33a534..f9f7584633 100644 --- a/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java +++ b/jOOQ/src/main/java/org/jooq/impl/AbstractDataType.java @@ -437,10 +437,10 @@ abstract class AbstractDataType extends AbstractNamed implements DataType // be a lot of data types constructed with a 0 value instead of // a null value, historically, so removing this check would // introduce a lot of regressions! - if (lengthDefined()) { + if (lengthDefined() && length() > 0) { return castTypePrefix0() + "(" + length() + ")" + castTypeSuffix0(); } - else if (precisionDefined()) { + else if (precisionDefined() && (isTimestamp() || precision() > 0)) { // [#8029] Not all dialects support precision on timestamp // syntax, possibly despite there being explicit or implicit