Re: Sequences/defaults and pg_dump

From: "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, PostgreSQL-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sequences/defaults and pg_dump
Date: 2006-02-28 13:11:50
Message-ID: e431ff4c0602280511t5c62457dp18c01d4829264521@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On 2/7/06, Martijn van Oosterhout <kleptog(at)svana(dot)org> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2006-02-28 13:22:58 Re: Temporal Databases, offtopic - relative updates
Previous Message pg 2006-02-28 13:01:44 implicit tables syntax disappeared from 8.0->8.1

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Pflug 2006-02-28 13:14:01 Re: new feature: LDAP database name resolution
Previous Message Alvaro Herrera 2006-02-28 12:50:24 Re: pg_config, pg_service.conf, postgresql.conf ....