When attempting to store ULong.MAX_VALUE in a ulong column, retrieving it results in -1 and not ULong.MAX_VALUE for all database dialects (except for MySQL and MariaDB). The reason is that we invoke .toLong() on the ULong value before we store it in the database (in notNullValueToDB in ULongColumnType) and that gets the -1 from here because of the implementation of ULong.toLong().
The fix:
Before this fix, the maximum value that could be stored with ULongColumnType for all database dialects (except for MySQL and MariaDB) was Long.MAX_VALUE. This is because the ULong value was being converted to Long in the notNullValueToDB function, restricting the range to that of Long. Instead, it is now converted to a BigInteger for PostgreSQL, a Long for PostgreSQLNG (with a range check), and a String for the rest of the database dialects. The ulong column can now store ULong.MAX_VALUE for H2 (excluding H2_PSQL), Oracle, SQLite and SQL Server.
Breaking change:
ulongType() is now NUMERIC(20) instead of BIGINT for H2 (excluding H2_PSQL), SQLite, and SQL Server to allow storing the full range of ULong, including ULong.MAX_VALUE.
Limitations:
For PostgreSQL, it is not possible to change ulongType() to NUMERIC(20) because that would cause a mismatch when it references an auto-incrementing ulong column of type BIGSERIAL. It's also not possible to change the autoIncType to NUMERIC(20) either, because PostgreSQL does not support the AUTO_INCREMENT property. So the maximum value that can be stored is Long.MAX_VALUE.
For SQLite, it is not possible to have auto-increment on a column of type other than INTEGER PRIMARY KEY, so the maximum value that can be stored using a ulong auto-increment column is the same as that of a long column.
The issue:
When attempting to store
ULong.MAX_VALUE
in aulong
column, retrieving it results in -1 and notULong.MAX_VALUE
for all database dialects (except for MySQL and MariaDB). The reason is that we invoke.toLong()
on theULong
value before we store it in the database (innotNullValueToDB
inULongColumnType
) and that gets the -1 from here because of the implementation ofULong.toLong()
.The fix:
Before this fix, the maximum value that could be stored with
ULongColumnType
for all database dialects (except for MySQL and MariaDB) wasLong.MAX_VALUE
. This is because theULong
value was being converted toLong
in thenotNullValueToDB
function, restricting the range to that ofLong
. Instead, it is now converted to aBigInteger
for PostgreSQL, aLong
for PostgreSQLNG (with a range check), and aString
for the rest of the database dialects. Theulong
column can now storeULong.MAX_VALUE
for H2 (excluding H2_PSQL), Oracle, SQLite and SQL Server.Breaking change:
ulongType()
is now NUMERIC(20) instead of BIGINT for H2 (excluding H2_PSQL), SQLite, and SQL Server to allow storing the full range ofULong
, includingULong.MAX_VALUE
.Limitations:
ulongType()
to NUMERIC(20) because that would cause a mismatch when it references an auto-incrementing ulong column of type BIGSERIAL. It's also not possible to change theautoIncType
to NUMERIC(20) either, because PostgreSQL does not support the AUTO_INCREMENT property. So the maximum value that can be stored isLong.MAX_VALUE
.ulong
auto-increment column is the same as that of along
column.