开发者

How do we define large integers? [duplicate]

This question already has answers here: Closed 11 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜