I'm running the following query:
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
on this 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)
)
The error message I get is
ERROR: integer out of range
SQL state: 22003
I've tried casting the match_id and team_id to bigint. Also looking online I see that people have this issue with the serial hitting the upper limit of integers. This doesn't seem to be the case:
SELECT nextval('dota_match_team_id_seq')
returns 31
Consider altering your table to use a bigger integer (see here for details: http://www.postgresql.org/docs/9.1/static/datatype-numeric.html).
I think the problem is, that your match_id
and team_id
are of type integer
and you try to insert the value 2281450916
, but integer's maximum is 2147483647
You can run this query:
ALTER TABLE dota_match_team alter column match_id type bigint;
this type cast solve the error for match_id. if you thinkIt is error of serial limit then you can also do.
SELECT setval('dota_match_team_id_seq' , 100000000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With