
Cohersion bug when using do_postgres and jruby
Reported by EccentricLamb | December 2nd, 2009 @ 10:42 AM | in 1.0.0
When using do_postgres under jruby, strings, which represent floats, are not being coerced properly into floats when the first digit is 0.
Example code at http://gist.github.com/247324
The example works under MRI 1.8.7 using do_mysql and
do_posgres.
The example works under jruby using do_mysql.
The example fails under jruby using do_postgres
Comments and changes to this ticket
-
Alex Coles December 3rd, 2009 @ 11:43 AM
- Assigned user set to Alex Coles
- State changed from new to unconfirmed
-
Alex Coles December 3rd, 2009 @ 11:43 AM
- Milestone set to 0.10.2
-
Alex Coles December 6th, 2009 @ 04:55 PM
@pieta Thanks for the patch a5f5c83. I did want to check with dbussink about the correct behaviour though. Postgres tends to be far stricter about coersion at the database level, hence the need for us to make coersions work at driver level. However, I am not sure to what extent we're going to want to support parameters as Strings (especially since this behaviour is not yet in our spec suite).
-
Dan Kubb (dkubb) December 6th, 2009 @ 05:27 PM
I was thinking of perhaps abstracting the String coercion behavior in DM into a shared library. It would have coercion methods for each of the primitive objects DO and DM support. Would that be useful in this case?
I could also move some of the coercion specs into shared specs within the package, that way if you wanted to implement an optimized version using C or Java, it would be possible.
-
Dan Kubb (dkubb) December 24th, 2009 @ 02:51 AM
- State changed from unconfirmed to hold
(from [8ba840300f2cc25c13f7d88f05fb0ab4bd8d988d]) [do_postgres] Revert "Added proper typecasting for doubles passed as string"
- Coersion should take place at a DataMapper-level. I don't yet understand the use-case for this at a DataObjects-level.
This reverts commit a5f5c830ac66c4255798b8cbcae6a4a2c07d7e2a.
Conflicts:
do_sqlite3/spec/spec_helper.rb
[#1142 state:hold]
Signed-off-by: Alex Coles alex@alexcolesportfolio.com
http://github.com/datamapper/do/commit/8ba840300f2cc25c13f7d88f05fb... -
Alex Coles December 24th, 2009 @ 02:55 AM
I've put this ticket on hold. I think coersion should take place in DataMapper. A float parameter must be passed to DO as a Float type. If we start trying to handle every single type, we add a huge amount of complexity to DO's JDBC implementation.
-
Dan Kubb (dkubb) December 27th, 2009 @ 02:57 PM
(from [641e0f5e72fb5607c97f9a228b68158e491e5b25]) [do_postgres] Revert "Added proper typecasting for doubles passed as string"
- Coersion should take place at a DataMapper-level. I don't yet understand the use-case for this at a DataObjects-level.
This reverts commit a5f5c830ac66c4255798b8cbcae6a4a2c07d7e2a.
Conflicts:
do_sqlite3/spec/spec_helper.rb
[#1142 state:hold]
Signed-off-by: Alex Coles alex@alexcolesportfolio.com
http://github.com/datamapper/do/commit/641e0f5e72fb5607c97f9a228b68... -
Dan Kubb (dkubb) February 1st, 2010 @ 04:33 PM
- Milestone changed from 0.10.2 to 1.0.0
-
Dan Kubb (dkubb) February 2nd, 2010 @ 04:03 AM
@alex: After thinking about this, I agree with you, DO should not be doing any coercion. What does dbussink say about the issue? If he doesn't want to do coercion, then perhaps we should close this.
-
Alex Coles February 2nd, 2010 @ 01:53 PM
- State changed from hold to not-applicable
I don't think DO should handle coercion. DM (and other DO API users) can handle coercion at ORM-level. Closing this.
@EccentricLamb (still feel free to comment if you think this decision is the wrong one...)
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
-
1142 Cohersion bug when using do_postgres and jruby [#1142 state:hold]
-
1142 Cohersion bug when using do_postgres and jruby [#1142 state:hold]