http://dev.rubyonrails.org/ticket/8054
alexeyv@alexeyv-laptop:~/src/rails/activerecord/test$ ruby -I
"connections/native_sqlite3" migration_test.rb
Using native SQLite3
Loaded suite migration_test
Started
............................FF......
Finished in 24.783783 seconds.
1) Failure:
test_native_decimal_insert_manual_vs_automatic(MigrationTest)
[migration_test.rb:233]:
<#<BigDecimal:b73cc1e0,'0.1234567890 1234567890
0123456789E20',32(36)>> expected but was
<#<BigDecimal:b73c5354,'0.1234567890 12346E20',16(20)>>.
2) Failure:
test_native_types(MigrationTest) [migration_test.rb:282]:
<#<BigDecimal:b761bd10,'0.1234567890 1234567890
0123456789E20',32(36)>> expected but was
<#<BigDecimal:b761bc70,'0.1234567890 12346E20',16(20)>>.
Hi Alex,
http://dev.rubyonrails.org/ticket/8054
alexeyv@alexeyv-laptop:~/src/rails/activerecord/test$ ruby -I
"connections/native_sqlite3" migration_test.rb
Using native SQLite3
Loaded suite migration_test
Started
............................FF......
Finished in 24.783783 seconds.
It looks like both of these are due to BigDecimal being down-
converted to Decimal. Alas, the sqlite3 adapter doesn't seem to
support BigDecimal:
activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
def native_database_types #:nodoc:
{
:primary_key => default_primary_key_type,
:string => { :name => "varchar", :limit => 255 },
:text => { :name => "text" },
:integer => { :name => "integer" },
:float => { :name => "float" },
:decimal => { :name => "decimal" },
:datetime => { :name => "datetime" },
:timestamp => { :name => "datetime" },
:time => { :name => "datetime" },
:date => { :name => "date" },
:binary => { :name => "blob" },
:boolean => { :name => "boolean" }
}
end
Does anyone know if that is a fundamental limitation of SQLite3, or
something we can simply add to the adapter?
-- Ernie P.
It looks like both of these are due to BigDecimal being down-
converted to Decimal. Alas, the sqlite3 adapter doesn't seem to
support BigDecimal:
Does anyone know if that is a fundamental limitation of SQLite3, or
something we can simply add to the adapter?
SQLite3 has a maximum precision of 16.
SQLite2 has no maximum as it stores decimals as strings internally.
Roderick
SQLite3 has a maximum precision of 16.
Make that 15 now that I'm double-checking it:
insert into test (nr) values (1234567890.123456789);
select * from test;
1234567890.12346
Roderick
Does anyone know if that is a fundamental limitation of SQLite3, or
something we can simply add to the adapter?
heh. Explains what this code was for:
http://dev.rubyonrails.org/changeset/6437
Reverting that changeset completely causes failure in sqlite2. So I
suppose it needs a version-aware special case. Anyone keen to take a
stab?