9

I want to change some data in a table with _id_seq suffix with this sql query:

UPDATE user_custom_fields_id_seq SET last_value = 1000;

but I get the following error:

ERROR: cannot change sequence "user_custom_fields_id_seq"

Is there anyway to bypass this error by using just SQL?

1 Answer 1

18

Use ATER SEQUENCE command:

ALTER SEQUENCE user_custom_fields_id_seq
    RESTART WITH 1000;

user_custom_fields_id_seq is not a table, it is a sequence.

Sign up to request clarification or add additional context in comments.

1 Comment

Or use setval()

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.