Re: Restart a sequence regularly - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Restart a sequence regularly
Date
Msg-id dcc563d10711210548hc42d7b9jcd8adb0a90abdb8b@mail.gmail.com
Whole thread Raw
In response to Restart a sequence regularly  ("Kathy Lo" <kathy.lo.ky@gmail.com>)
Responses Re: Restart a sequence regularly  (Marco Colombo <marco@esi.it>)
List pgsql-general
On Nov 21, 2007 1:39 AM, Kathy Lo <kathy.lo.ky@gmail.com> wrote:
> 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.

revoke all privs on the sequence to anyone but the user about to reset it
reset it
grant the options back

pgsql-general by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: maximum size of plpgsql function parameter
Next
From: Reg Me Please
Date:
Subject: Table filter