未验证 提交 b76bc15c 编写于 作者: S Serge Rider 提交者: GitHub

Merge pull request #12736 from dbeaver/postgres-interval-type-ddl-fix#9013

#9013 Don't append precision for intervals without precision
......@@ -436,8 +436,6 @@ public class PostgreUtils {
return 6;
return typmod;
case PostgreOid.INTERVAL:
if (typmod == -1)
return 6;
return (short) (typmod & INTERVAL_MASK_PRECISION);
default:
return 0;
......
......@@ -98,10 +98,10 @@ public class PostgreTableColumnManager extends SQLTableColumnManager<PostgreTabl
}
break;
case DATETIME:
final int timePrecision = CommonUtils.toInt(postgreColumn.getPrecision());
final Integer timePrecision = postgreColumn.getPrecision();
String typeName = column.getTypeName();
if (typeName.startsWith(PostgreConstants.TYPE_TIMESTAMP) || typeName.equals(PostgreConstants.TYPE_TIME)) {
if (timePrecision >= 0 && timePrecision <= 6) {
if (timePrecision != null && timePrecision >= 0 && timePrecision <= 6) {
sql.append('(').append(timePrecision).append(')');
}
}
......@@ -110,10 +110,11 @@ public class PostgreTableColumnManager extends SQLTableColumnManager<PostgreTabl
if (!CommonUtils.isEmpty(precision)) {
sql.append(' ').append(precision);
}
if (PostgreUtils.isPrecisionInterval(postgreColumn.getTypeMod()) && timePrecision >= 0 && timePrecision <= 6) {
if (PostgreUtils.isPrecisionInterval(postgreColumn.getTypeMod()) && timePrecision != null && timePrecision >= 0 && timePrecision <= 6) {
sql.append('(').append(timePrecision).append(')');
}
}
break;
}
if (PostgreUtils.isGISDataType(postgreColumn.getTypeName())) {
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册