title: Changing a sequence datatype from INT to BIGINT PostgreSQL
body: <p>Hi I have PostgreSQL database with some values. When I created the tables, I didn’t pay much attention to their ID column. Now if I check the sequences, I see that the max value of some of them is of type int. How to change them to bigint without changing the IDs of the data. I changed the ID fields type in the tables from int to bigint. then
  <code>ALTER SEQUENCE public.kvitansiya_id_seq MAXVALUE 9223372036854775807;</code> command returns an error such as</p>
  <blockquote>
  <p>SQL Error [22023]: ERROR: MAXVALUE (9223372036854775807) out of
  sequence data type (integer).</p>
  </blockquote>
  <p>Here is photo of sequences tables on DBeaver.</p>
  <p><a href="https://i.stack.imgur.com/I13eW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I13eW.png" alt="enter image description here" /></a></p>