Digest for jooq-user@googlegroups.com - 3 updates in 1 topic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digest for jooq-user@googlegroups.com - 3 updates in 1 topic

http://groups.google.com/group/jooq-user/topics mailing list
Lukas Eder <[hidden email]>: Nov 23 12:47PM +0100

Thank you very much for your report. I can reproduce this issue:
https://github.com/jOOQ/jOOQ/issues/6850
 
Will look into this soon,
Lukas
 
Lukas Eder <[hidden email]>: Nov 23 01:07PM +0100

Hmm, this will be tricky without actually supporting the money type
formally (https://github.com/jOOQ/jOOQ/issues/4364).
 
The PostgreSQL JDBC driver will "toString" the monetary amount, which
produces a locale-dependent value. This is hard to parse back again into
jOOQ's current BigDecimal mapping. Will need to think about this a bit more
thoroughly. Further discussion directly on the issue #6850
 
Lukas Eder <[hidden email]>: Nov 23 01:16PM +0100

... the more I'm reading about this money type, the more I'm convinced it
should not be used at all:
https://stackoverflow.com/a/18170030/521799
 
The decimal precision is fixed by the server's relevant lc_monetary
setting, but what if that setting changes? Will we lose precision,
suddenly? What if we're in Switzerland (0.## precision) but we want to
trade with stocks (often usually 0.#### precision)? Is it still an
appropriate type?
 
Given that not even the JDBC driver correctly handles the money type after
a simple test (pardon my German):
 
ResultSet rs = s.executeQuery("SELECT 1234.50::money");
rs.next();
rs.getObject(1);
 
org.postgresql.util.PSQLException: Unzulässiger Wert für den Typ double :
CHF 1'234.50.
at org.postgresql.jdbc.PgResultSet.toDouble(PgResultSet.java:2921)
at org.postgresql.jdbc.PgResultSet.getDouble(PgResultSet.java:2338)
at org.postgresql.jdbc.PgResultSet.internalGetObject(PgResultSet.java:193)
at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:2589)
at Postgres.main(Postgres.java:28)
 
 
I'm getting to the conclusion that we should unsupport the money type and
recommend not to use it. Nevertheless, you can always implement your own
data type binding for top-level money type usage:
https://www.jooq.org/doc/latest/manual/sql-building/queryparts/custom-bindings
 
Which will probably, unfortunately, not work if your type is inside of a UDT
 
So, I'm afraid, I won't have a solution here.
Lukas
 
 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].