# Resetting sequences. All of them, please!

DevFeed: [Resetting sequences. All of them, please!](<https://devfeed.tech/articles/resetting-sequences-all-of-them-please-34361.md>)

Original publisher: [Read original article](<https://tapoueh.org/blog/2010/02/resetting-sequences.-all-of-them-please/>)

Author: Dimitri Fontaine PostgreSQL Major Contributor; Author

Published: 2010-02-16T15:23:00Z

Content type: tutorial

Language: en

Sources: [Dimitri Fontaine](<https://devfeed.tech/sources/dimitri-fontaine.md>)

Topics: [Sequences](<https://devfeed.tech/topics/sequences.md>), [Scripting](<https://devfeed.tech/topics/scripting.md>), [SQL](<https://devfeed.tech/topics/sql.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [dump](<https://devfeed.tech/tags/dump.md>), [irc](<https://devfeed.tech/tags/irc.md>), [production](<https://devfeed.tech/tags/production.md>), [script](<https://devfeed.tech/tags/script.md>), [scripting](<https://devfeed.tech/tags/scripting.md>), [sequences](<https://devfeed.tech/tags/sequences.md>), [sql](<https://devfeed.tech/tags/sql.md>), [support](<https://devfeed.tech/tags/support.md>)

## AI overview

A blog article explains how to restore sequence values after a production dump has been filtered. It describes querying the database catalog for all sequences and generating commands to reset them, with execution in an explicit transaction block.

## Source excerpt

So, after restoring a production dump with intermediate filtering, none of our sequences were set to the right value. I could have tried to review the process of filtering the dump here, but it's a one-shot action and you know what that sometimes mean. With some pressure you don't script enough of it and you just crawl more and more. Still, I think how I solved it is worthy of a blog entry. Not that it's about a super unusual clever trick, quite the contrary, because questions involving this trick are often encountered on the support IRC.