jdbcpostgresql adapter inserts invalid number literals into generated SQL, 
causes exceptions
--------------------------------------------------------------------------------------------

                 Key: JRUBY-2534
                 URL: http://jira.codehaus.org/browse/JRUBY-2534
             Project: JRuby
          Issue Type: Bug
          Components: ActiveRecord-JDBC
    Affects Versions: JRuby 1.1.1
         Environment: Win32 + JDK6 + JRuby 1.1 + Rails 2.0.2
PostgreSQL 8.2 + activerecord-jdbcpostgresql-adapter-0.8

            Reporter: Tony Spataro


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!)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to