[英]Postgresql with python psycopg DataError: integer out of range
I have a line of code thate give me this error: DataError: integer out of range
我有一行代码给我这个错误:
DataError: integer out of range
The line of code is this : 代码行是这样的:
c.execute("INSERT INTO Users_Chat (Chat, User, Name, Id) VALUES (%s, %s, %s, %s)", (chat_version, user_id, name_user, 0, ))
I have created the table and columns with this command: 我已经使用以下命令创建了表和列:
CREATE TABLE Users_Chat (Chat INT, User INT, Name TEXT, Id INT);
c.execute("INSERT INTO Users_Chat (Chat, User, Name, Id) VALUES (%s, %s, %s, %s)", (chat_version, user_id, name_user, 0, ))
Expects only numeric/ingegers values according to doc. 根据文档仅需要数字/整数值。
Python numeric objects int, long, float, Decimal are converted into a PostgreSQL numerical representation:
Python数字对象int,long,float,Decimal被转换为PostgreSQL数字表示形式:
https://www.postgresql.org/docs/current/static/datatype-numeric.html https://www.postgresql.org/docs/current/static/datatype-numeric.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.