Hello,
There's a common misconception among MySQL users that TINYINT(1) is:
- A good hint for the type to have boolean semantics
- An actual type
When you specify TINYINT(1), the type will still be a TINYINT. Observe the following:
CREATE TABLE t(i TINYINT(1));
INSERT INTO t VALUES (1);
INSERT INTO t VALUES (2);
INSERT INTO t VALUES (10);
You'll get:
i
--
1
2
10
That explains why it would be unwise for jOOQ to consider that "length" information for any type deduction.
The "global" type conversion mechanism that you could use would be to create your own general-purpose Binding and use that for every dynamically created column expression (you'd have to know these columns in advance, though).
Otherwise, you could patch jOOQ's internal MetaDataFieldProvider and put the desired logic there.
In any case, I think your idea is very interesting. jOOQ should have an SPI that allows for overriding such default types at runtime. I've created a feature request for this:
Cheers,
Lukas