fix(kingbase): omit invalid varchar length in exported DDL

This commit is contained in:
zipg authored and GitHub committed 2026-07-16 17:30:34 +08:00
1 parent efe883f0d8
commit 67b04f5635
2 files changed
+20 -2

No files matched your search

@@ -218,8 +218,9 @@ public final class DdlBuilder {
private static String columnTypeSql(ColumnInfo column) {
String type = column.getData_type();
String normalized = type.toLowerCase(Locale.ROOT);
if (isCharacterType(normalized) && column.getCharacter_maximum_length() != null) {
return type + "(" + column.getCharacter_maximum_length() + ")";
Integer characterLength = column.getCharacter_maximum_length();
if (isCharacterType(normalized) && characterLength != null && characterLength > 0) {
return type + "(" + characterLength + ")";
}
if (isNumericType(normalized) && column.getNumeric_precision() != null) {
if (column.getNumeric_scale() != null) {