What's the best way to atomically update a sequence in Postgres?
Context: I'm bulk inserting objects with SQLAlchemy, and exectutemany can't return defaults, so I'd like to increment the primary key sequence by the amount of objects I need to insert.
I know I can do:
ALTER SEQUENCE seq INCREMENT BY 1000;
But I'm not sure if that's safe to do in concurrent environments.