View Full Version : how to reset value of a sequence?
| Good day!
How do I reset the value of a sequence without dropping the table?
Could you help me out? :) |
you can do this by updateing one of the system tables
It's a long time ago since I've done this.
I will look it up and post it.
But this is a very dangerous procedure to reset the sequence.
I've forgotten the easy method to reset the sequence is to pg_dumpall of your database
and then search fpr the sequence in the ascii file and you can change the setting also there
and then import your data in den dbserver and theen the sequence is changed
with this method you can change the sequence to any value you want.
BUT NOTICE THIS DANGERAOUS DEALING WITH SUCH THINGS ON A PRODUCTION SYSTEM.
| use \d [sequence]
and use setval to change the value of the sequence |
Originally posted by zdeh98
Good day!
How do I reset the value of a sequence without dropping the table?
Could you help me out? :)
Is enough:
DROP SEQUENCE sequence_name;
and after the first increment will be recreated.
vBulletin v3.5.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.