我正在运行以下查询:
WITH match_team_vals(match_id, team_id, is_radiant) AS (
VALUES
(2281450916, 2783913, true),
(2281450916, 2538753, false)
)
INSERT INTO dota_match_team(match_id, team_id, is_radiant)
SELECT match_id, team_id, is_radiant
FROM match_team_vals
RETURNING id AS lineup_id
在这张 table 上:
CREATE TABLE dota_match_team
(
id serial NOT NULL,
match_id integer NOT NULL,
team_id integer,
is_radiant boolean NOT NULL,
CONSTRAINT dota_match_teams_pkey PRIMARY KEY (id)
)
我得到的错误信息是
ERROR: integer out of range
SQL state: 22003
我试过将 match_id 和 team_id 转换为 bigint。另外在网上看,我看到人们对连续剧达到整数上限有这个问题。这似乎不是这样的:
SELECT nextval('dota_match_team_id_seq')
returns 31
最佳答案
考虑更改您的表格以使用更大的整数(有关详细信息,请参见此处:http://www.postgresql.org/docs/9.1/static/datatype-numeric.html)。
我认为问题是,您的 match_id
和 team_id
是 integer
类型,您尝试插入值 2281450916
,但整数的最大值是 2147483647
关于sql - Postgres : integer out of range,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36513168/