This project is archived and is in readonly mode.

#4967 ✓resolved
kdgundermann

rake test fails in create_table :numeric_data on MS SQL Server

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

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

Comments and changes to this ticket

  • kdgundermann

    kdgundermann June 25th, 2010 @ 09:19 AM

    • Tag set to rails 3.0.0.beta4
  • kdgundermann

    kdgundermann June 25th, 2010 @ 09:26 AM

    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.

  • Rohit Arondekar

    Rohit Arondekar June 25th, 2010 @ 11:03 AM

    • 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

  • kdgundermann

    kdgundermann June 25th, 2010 @ 12:05 PM

    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.

  • Rohit Arondekar

    Rohit Arondekar June 25th, 2010 @ 12:12 PM

    Yes that's been happening a lot. :(

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

  • kdgundermann

    kdgundermann June 25th, 2010 @ 12:42 PM

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

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

  • Rohit Arondekar

    Rohit Arondekar June 25th, 2010 @ 12:51 PM

    • 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?

  • Ken Collins

    Ken Collins August 10th, 2010 @ 08:57 PM

    • 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

  • Henrik Hodne

    Henrik Hodne August 11th, 2010 @ 01:17 AM

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

  • Rohit Arondekar

    Rohit Arondekar January 27th, 2011 @ 06:28 AM

    • 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.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages