我正在尝试保存一个表示文件长度的数字(4825733517)。该列设置为integer类型。我没有设置任何验证或限制。
RangeError: 4825733517 is out of range for ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer with limit 4我应该对这个值使用其他列类型吗?(在rails 4.2.4上)
发布于 2015-11-04 17:01:38
根据the PostgreSQL documentation,整数的范围从-2147483648到+2147483647。所以你的数字对于这种类型来说太大了。
更新您的列,并使用参数limit来指示您想要一个bigint。
change_column :table, :column, :integer, limit: 8https://stackoverflow.com/questions/33517403
复制相似问题