Sql – libpq send integer as binary

binarycintegerlibpqpostgresql

I have a libpq program that is routinely inserting numbers into a database. These numbers, which I'm expecting to grow quite large, are stored int the uint64_t type. I'm wanting to send the integer to libpq as binary, but Postgres won't be able to tell its unsigned. Is there a way to specify an unsigned integer in Postgres or libpq?

Best Answer

There are no unsigned datatypes in PostgreSQL.

If you really are going over 9223372036854775808, then you should use NUMERIC data type.