To reset a sequence so that the next time it's used it returns 1 run the following SQL:
The first parameter is the sequence name to set the value of, the next is the value to set it to, and the third field is whether the sequence should return this value or the next increment when it is used next.
For the official documentation please read chapter 9.12. Sequence Manipulation Functions from the PostgreSQL 8.0.7 Documentation.
Technorati Tags: PostgreSQL, Database, Andrew Beacock
select setval('my_sequence_sq1', 1, false);
The first parameter is the sequence name to set the value of, the next is the value to set it to, and the third field is whether the sequence should return this value or the next increment when it is used next.
For the official documentation please read chapter 9.12. Sequence Manipulation Functions from the PostgreSQL 8.0.7 Documentation.
Technorati Tags: PostgreSQL, Database, Andrew Beacock
Comments