How do we define large integers? [duplicate]
Possible Duplicate:
Integer out of range on Postgres DB
When my code tries to insert big numbers such as 100001857905525
into a database on heroku, I get the error:
ActiveRecord::StatementInvalid (PGError: ERROR: integer out of range )
The colum开发者_如何学运维n has been defined as an integer. I use a sqlite3 database. My code is deployed to heroku.
It works fine when I run on localhost. But I get the above error only when I run the code on heroku. Perhaps I can solve the issue by defining the column as a long integer or a double. How do I do this in Ruby/Rails ?
in your migration, you could try this:
t.integer :uid, :limit => 8
which will produce a 64-bit integer column.
(Just integer
with no limit
specified will allow, according to the PostgreSQL docs, up to 10 digits.)
精彩评论