Search Postgresql Archives

Re: Sequences/defaults and pg_dump

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/7/06, Martijn van Oosterhout <kleptog@xxxxxxxxx> wrote:
> On Tue, Feb 07, 2006 at 03:28:31PM +0300, Nikolay Samokhvalov wrote:
> > The real situation would be as the following.
> > I want to use some algorithm to hide real number of registered users
> > in my table user. So, I don't want to use simple sequence, when every
> > new registered user in my system can guess what is the number of
> > registered users simply observing his ID. So, I use following
> > algorithm:
> > (nextval('...name of the sequnence...') * N) mod % M,
> > where N and M are quite big numbers that have no common multiples
> > besides 1 (sorry, do not remember the English term for those numbers
> > ;-) ).
>
> Even then you could do it by saying:
>
> ALTER SEQUENCE x MAXVALUE M INCREMENT N CYCLE;
>
it's a pity, but no, I can't :-(
after reaching MAXVALUE sequence starts with MINVALUE (1 by default)...
for example with following sequence:

test=#  CREATE SEQUENCE testseq INCREMENT BY 3 MAXVALUE 10 CYCLE;

...I always obtain only 1, 4, 7 and 10... ;-(

--
Best regards,
Nikolay

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux