Re: Restart a sequence regularly

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Kathy Lo" <kathy(dot)lo(dot)ky(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Restart a sequence regularly
Date: 2007-11-21 13:48:50
Message-ID: dcc563d10711210548hc42d7b9jcd8adb0a90abdb8b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Nov 21, 2007 1:39 AM, Kathy Lo <kathy(dot)lo(dot)ky(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Reg Me Please 2007-11-21 14:21:57 Table filter
Previous Message Peter Eisentraut 2007-11-21 12:20:07 Re: [GENERAL] possible to create multivalued index from xpath() results in 8.3?