简体   繁体   English

libpq将整数作为二进制发送

[英]libpq send integer as binary

I have a libpq program that is routinely inserting numbers into a database. 我有一个libpq程序,该程序通常将数字插入数据库中。 These numbers, which I'm expecting to grow quite large, are stored int the uint64_t type. 这些数字(我希望会越来越大)存储在uint64_t类型中。 I'm wanting to send the integer to libpq as binary, but Postgres won't be able to tell its unsigned. 我想将整数作为二进制发送给libpq,但Postgres将无法分辨其未签名。 Is there a way to specify an unsigned integer in Postgres or libpq? 有没有一种方法可以在Postgres或libpq中指定无符号整数?

There are no unsigned datatypes in PostgreSQL. PostgreSQL中没有未签名的数据类型。

If you really are going over 9223372036854775808, then you should use NUMERIC data type. 如果您确实要查看9223372036854754775808,则应使用NUMERIC数据类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM