Resetting SEQUENCEs

From: Laurent ROCHE <laurent_roche(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Resetting SEQUENCEs
Date: 2007-10-18 17:06:00
Message-ID: 314407.22600.qm@web34403.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I am quite surprised I could not find a way to automatically reset the value of a sequence for all my tables.

Of course, I can write:
SELECT setval('serial', max(id)) FROM distributorsBut if I reload data into all my tables, it's a real pain to have to write something like this for every single table with a sequence.

I would expect PostgreSQL to provide some command like:
resynchAllSequences my_schema;

Can this be a feature in the future ?

Does anybody have a solution for now ? A script or (even better) a pl/pgSql function ?

Cheers,
L(at)u
The Computing Froggy

_____________________________________________________________________________
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shane Ambler 2007-10-18 17:27:18 Re: Problem of installation on Mac
Previous Message Bob Pawley 2007-10-18 16:58:10 Re: ordering rows