jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-2534

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

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major 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!)

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Nick Sieger added a comment - 04/Jun/08 12:33 PM

Can you provide a test case or a simple code snippet that triggers this issue?

Show
Nick Sieger added a comment - 04/Jun/08 12:33 PM Can you provide a test case or a simple code snippet that triggers this issue?
Hide
Permalink
Charles Oliver Nutter added a comment - 05/Feb/09 12:59 AM

No follow up when a test case was requested. Closing as incomplete.

Show
Charles Oliver Nutter added a comment - 05/Feb/09 12:59 AM No follow up when a test case was requested. Closing as incomplete.

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Tony Spataro
Vote (0)
Watch (2)

Dates

  • Created:
    19/May/08 12:23 AM
    Updated:
    27/Oct/09 1:48 PM
    Resolved:
    05/Feb/09 12:59 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.