title: Postgres: integer out of range
body: <p>I'm running the following query:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>on this table:</p>
  
  <pre><code>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)
  )
  </code></pre>
  
  <p>The error message I get is</p>
  
  <pre><code>ERROR: integer out of range
  SQL state: 22003
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>SELECT nextval('dota_match_team_id_seq')
  returns 31
  </code></pre>