Should I use numeric if I get this integer out of range error in Postgrex?

Hi, so I’m getting the following trying to save to an integer column in the Postgres database of my Phoenix application.

(ArgumentError) Postgrex expected an integer in -2147483648…2147483647 that can be encoded/cast to type “int4”, got 5123906385. Please make sure the value you are passing matches the definition in your table or in your query or convert the value accordingly.

Looking at GitHub - elixir-ecto/postgrex: PostgreSQL driver for Elixir README, it looks like numeric is the only way to go then? What are the drawbacks of numeric field type?

Or use :bigint for your type to support 64-bit integers. :slight_smile:

2 Likes

Thanks, I googled a bit - where did you find :bigint as a mapping - is it in the docs somewhere and I just missed it?