How to restart PostgreSQL sequences handled by Hibernate?

Viewed 4508

I've been tasked with restarting a sequence for many different serial columns in a PostgreSQL database. Normally, I would simply use:

ALTER SEQUENCE serial RESTART WITH 105;

However, it seems that Hibernate is being used to handle the database sequences. I really don't know anything about Hibernate, but my understanding is that hibernate_sequence is a global sequence for all tables. Is that correct?

I'm assuming that I would need to do the following, then:

ALTER SEQUENCE hibernate_sequence RESTART WITH 105;

But I am not sure what the consequence will be. Let's assume I have Tables A, B, C, and D. Each of those tables has an ID column of type serial. Will the above SQL statement on hibernate_sequence restart the ID column for ALL of the tables?

Thanks!

1 Answers
Related