6

I am getting PGError: ERROR: integer out of range message from trying to insert the following integer: 100001389928198.

According to the Postgres docs on numeric datatypes the limit is much higher (9223372036854775807). I have a feeling Heroku is treating the column as a regular integer rather than a BIGINT.

I defined the migration as a BIGINT as such:

t.column :uid, :bigint

is this not correct in terms of Heroku migrations?

3
  • wow that's a big number! What are you using it for? Commented Dec 30, 2012 at 11:52
  • its a facebook uid (for oauth stuff) Commented Dec 31, 2012 at 1:26
  • I see. So I guess we will start using these larger int fields now. Commented Dec 31, 2012 at 7:59

1 Answer 1

9

I am not sure t.column is same as change_column or not, but here is how according to api

change_column :table_name, :uid, :bigint
Sign up to request clarification or add additional context in comments.

3 Comments

my original migration was as stated above, but running this one did the trick. thanks!
this worked for me too.. surprising given that :bigint isn't listed as one of the column types in the migrations guide and that :limit => 8 seemed to work for me on pg locally..
Hmm...I tried this and got the error undefined method `bigint' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition:0x000000045beb50> Ended up doing t.integer :field, :limit => 8 instead to limit the size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.