【发布时间】:2020-03-22 08:11:10
【问题描述】:
我在尝试插入全新数据库上的全新表时收到value "1574799549227" is out of range for type integer 错误。我正在使用带有 pg 模块的节点。
db
.query(`INSERT INTO users (uuid, email, password, created_at, updated_at) VALUES ($1, $2, $3, to_timestamp($4 / 1000), to_timestamp($4 / 1000))`,
[uuid, email, password, Date.now()])
.catch((err) => {
console.log(err);
});
这是桌子
CREATE TABLE public.users
(
id serial,
uuid uuid,
email character varying,
password character varying,
created_at timestamp with time zone,
updated_at timestamp with time zone,
CONSTRAINT user_id_pk PRIMARY KEY (id)
)
我也尝试过重置 id 字段的序列号
【问题讨论】:
-
使用 bigserial 或 bigint 而不是 serial 或 uuid
-
@nacho 我已将它切换到 bigserial,它不能解决问题。这也不应该是一个问题,因为数据库和表是全新的..
-
1 美元有什么价值??
标签: sql node.js database postgresql