Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Incomplete
-
Affects Version/s: JRuby 1.1.1
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Win32 + JDK6 + JRuby 1.1 + Rails 2.0.2
PostgreSQL 8.2 + activerecord-jdbcpostgresql-adapter-0.8
Description
I have a database column that is defined thusly (using a migration):
t.column :value, :decimal, :precision=>48, :scale=>8, :null=>false
When the migration is executed, it creates the following column definition:
ALTER TABLE flows ADD COLUMN amount numeric(48,8);
This causes a two-fold problem. When I attempt to save a new ActiveRecord object whose "value" attribute is set to something sensible, e.g. "41.23" I get the following exception:
ActiveRecord::ActiveRecordError: ERROR: syntax error at or near ".0": INSERT INTO daily_quotes ("asset_id", "quoted_on", "value", "value_asset_id") VALUES(201, '2008-05-16 00:00:00', 4E+1.0, 175)
As you can see, the DB adapter is generating syntactically invalid SQL to represent my number. (In addition it seems to be truncating the value of my number!)
Can you provide a test case or a simple code snippet that triggers this issue?