Restart a sequence regularly

Поиск
Список
Период
Сортировка
От Kathy Lo
Тема Restart a sequence regularly
Дата
Msg-id c10e7feb0711202339j2fda10cbn41262c7bbdcfea60@mail.gmail.com
обсуждение исходный текст
Ответы Re: Restart a sequence regularly
Re: Restart a sequence regularly
Список pgsql-general
Hi,

I am using Postgresql 8.0.3 in Fedora Core 4.

In my database, it contains a sequence. And, I need to alter the range
of this sequence and restart it to the start of the new range at
00:00:00 on 1st January on every year. 5 seconds before and after that
time, I need to prevent users from calling nextval() to retrieve the
next number from this sequence.

I can write a Perl script to alter the sequence and schedule to run
this script at 23:59:55 on 31st December on every year.

But, I don't know how to lock the sequence to prevent others from
accessing this sequence to get next number and Postgresql does not
support to lock a sequence.

How can I prevent others from accessing the sequence, like locking a
table? That means, when others want to access the sequence between
31-Dec 23:59:55 and 1-Jan 00:00:05, they are waiting instead of
getting an error.

Thank
--
Kathy Lo

В списке pgsql-general по дате отправления:

Предыдущее
От: Dane Springmeyer
Дата:
Сообщение: Normalization tools for postgres?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: MAybe a FAQ