[jOOQ/jOOQ#8029] Fix TIMESTAMP(0) precision

This commit is contained in:
Lukas Eder 2020-07-08 14:27:24 +02:00
parent 6a7e194113
commit 4b68d9cd17

View File

@ -437,10 +437,10 @@ abstract class AbstractDataType<T> extends AbstractNamed implements DataType<T>
// 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