13

Currently I am importing data from a RabbitMQ worker to a table in postgreSQL. In doing so I received this error:

4|tiq-work | error: nextval: reached maximum value of sequence "table_id_seq" (2147483647)

table.id has a data type of int8 (bigint) which has a range of 9223372036854775807

I tried to set the max value using this command from the postgreSQL documentation:

alter sequence schema.table_id_seq maxvalue 9223372036854775807;

But then receive this error:

SQL Error [22023]: ERROR: MAXVALUE (9223372036854775807) is out of range for sequence data type

This appears to be because the range for sequence data type is the same as the integer data type (2147483647).

Is there a way to force this to go higher? I still have a lot of data to load.

5
  • And what is the definition for the table? Commented Jun 10, 2019 at 21:03
  • 14
    Did you try changing it to bigint? ALTER SEQUENCE table_id_seq AS bigint; Commented Jun 10, 2019 at 21:13
  • @wildplasser, sorry, not to sure what you are asking. Commented Jun 10, 2019 at 22:22
  • I was asking for the definition (DDL) for the table that uses this sequence. Commented Jun 10, 2019 at 22:27
  • @Jeremy Thanks!! That fixed it! Commented Jun 10, 2019 at 22:38

1 Answer 1

17

You also need to convert the sequence to a bigint. Try this:

ALTER SEQUENCE "table_id_seq" AS bigint MAXVALUE 9223372036854775807;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.