A better cutoff for VARCHAR -> TEXT for MySQL.

In this brave new world of multiple character sets, we need to be more
conservative.
This commit is contained in:
Michael Bayne
2026-03-30 10:54:03 -07:00
parent 0f5e0e2203
commit 764b887ccc
@@ -288,7 +288,9 @@ public class MySQLBuilder
return "DOUBLE";
}
public String getStringType (int length) {
return (length < (1 << 15)) ? "VARCHAR(" + length + ")" : "TEXT";
// MySQL VARCHAR max is floor(65535/max_char_bytes); for utf8mb4 that's 16383.
// Use 16383 as the threshold to be safe with any character set.
return (length <= 16383) ? "VARCHAR(" + length + ")" : "TEXT";
}
public String getDateType (int length) {
return "DATE";