Describe the bug
When working with a query column of type INT8 (from CockroachDB or PostgreSQL), assigning a numeric value fails with:
ortus.boxlang.runtime.types.exceptions.BoxCastException: Could not cast object [Number] to type [bigint]
This happens during direct assignment like q["id"][1] = 105.
Environment
- BoxLang version: v1.11.0+52
- Database: CockroachDB (reports
INT8for auto-incrementing IDs and large integers) - JDBC driver: PostgreSQL JDBC
To Reproduce
- Create table (CockroachDB example):
CREATE TABLE test_numbers (
id INT8 PRIMARY KEY,
views INT8 DEFAULT 0
);
INSERT INTO test_numbers (id, views) VALUES (1, 5);
- script to test:
<cfscript>
q = queryExecute(
"SELECT id, views FROM test_numbers",
{},
{ datasource = "yourCockroachDSN" }
);
writeDump(q); // shows columns as bigint internally
try {
q["views"][1] = 105; // ← fails here
// or q["id"][1] = 999;
writeDump(q);
} catch (any e) {
writeDump(e);
}
</cfscript>
Expected behavior
BoxLang should allow assigning a numeric value (Number, integer literal, etc.) to a query column reported as bigint (from INT8).
Actual behavior
Fails with BoxCastException in GenericCaster.cast() when target type is “bigint”.
Workaround
Changing column to INT4 makes internal type “integer” → assignment succeeds.
Notes
- Happens specifically with CockroachDB’s INT8 type reporting.
- Does not fail with MySQL BIGINT in my tests (different internal mapping?).
- Full stack trace points to QueryColumn.assign() → GenericCaster.cast().