Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rake test fails in create_table :numeric_data on MS SQL Server

#4967

C:/RailsTest/rails3test/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:211:in rescue in log’: ODBC::Error: 37000 (2750) [Microsoft][SQL Native Client][SQL Server]Spalte oder Parameter Nr. 8: Die angegebene Spaltengenauigkeit 55 ist gr÷▀er als die maximale Genauigkeit 38.: CREATE TABLE [numeric_data] ([id] int NOT NULL IDENTITY PRIMARY KEY, [bank_balance] decimal(10,2), [big_bank_balance] decimal(15,2), [world_population] decimal(10,0), [my_house_population] decimal(2,0), [decimal_number_with_default] decimal(3,2) DEFAULT 2.78, [temperature] float(8), [atoms_in_universe] decimal(55,0)) (ActiveRecord::StatementInvalid)

decimal only allows 38 digits on SQL Server 2005

Reported by kdgundermann · June 25th, 2010 @ 09:16 AM

State: resolved
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. kdgundermann
    kdgundermann
    • Tag set to rails 3.0.0.beta4

    June 25th, 2010 @ 09:19 AM

  2. kdgundermann
    kdgundermann
    diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
    index b212e7c..5f87898 100644
    --- a/activerecord/test/schema/schema.rb
    +++ b/activerecord/test/schema/schema.rb
    @@ -313,8 +313,8 @@ ActiveRecord::Schema.define do
         t.decimal :my_house_population, :precision => 2, :scale => 0
         t.decimal :decimal_number_with_default, :precision => 3, :scale => 2, :default => 2.78
         t.float   :temperature
    -    # Oracle supports precision up to 38
    -    if current_adapter?(:OracleAdapter)
    +    # Oracle and Microsoft supports precision up to 38
    +    if current_adapter?(:OracleAdapter) || current_adapter?(:SQLServerAdapter)
           t.decimal :atoms_in_universe, :precision => 38, :scale => 0
         else
           t.decimal :atoms_in_universe, :precision => 55, :scale => 0
    

    Edited by Rohit Arondekar for formating.

    June 25th, 2010 @ 09:26 AM

  3. Rohit Arondekar
    Rohit Arondekar
    • Tag changed from rails 3.0.0.beta4 to rails 3, activerecord, oracle, tests
    • State changed from new to incomplete

    Can you make a patch that gives you credit? :) This should help http://rails.lighthouseapp.com/projects/8994/sending-patches

    June 25th, 2010 @ 11:03 AM

  4. kdgundermann
    kdgundermann

    Hi Rohit,

    yes I have made a patch, but i can't upload the file...
    always get an error:

    Sorry, you've stumbled on an error

    It looks like you've stumbled on an error. We've been notified of the problem.

    Go back to the page you were on.

    Edited by Rohit Arondekar to fix formating.

    June 25th, 2010 @ 12:05 PM

  5. Rohit Arondekar
    Rohit Arondekar

    Yes that's been happening a lot. :(

    Can you please put it in a gist (http://gist.github.com) and link it here?

    June 25th, 2010 @ 12:12 PM

  6. kdgundermann
    kdgundermann
    • Tag changed from rails 3, activerecord, oracle, tests to rails 3, activerecord, sqlserver, tests

    git://gist.github.com/452747.git

    June 25th, 2010 @ 12:42 PM

  7. Rohit Arondekar
    Rohit Arondekar
    • State changed from incomplete to open

    A more click and browse friendly link of the above patch -> http://gist.github.com/452747

    kdgundermann, note that you will not get credit for the patch unless you add a name! It says unknown right now. :)

    Can somebody please verify/review this patch?

    June 25th, 2010 @ 12:51 PM

  8. Ken Collins
    Ken Collins
    • Importance changed from to Low

    I am the author for the SQL Server adapter. I had opened a ticket for this without knowing there was one already open. My ticket #5333 can be found here and is quite well tested. It also does more in that it accounts for a bad schema that shows it self while I was testing in 1.9.2 as well. Perhaps close this ticket and use this one with a tested patch.

    https://rails.lighthouseapp.com/projects/8994/tickets/5333

    August 10th, 2010 @ 08:57 PM

  9. Henrik Hodne
    Henrik Hodne

    The author of the gist has added his name to the gist and updated it. Just FYI.

    August 11th, 2010 @ 01:17 AM

  10. Rohit Arondekar
    Rohit Arondekar
    • State changed from open to resolved

    Closing ticket as resolved since the patch submitted by Ken Collins in #5333 has been committed. If you still feel this issue is not resolved please leave a comment and I'll re-open it.

    January 27th, 2011 @ 06:28 AM