Re: Create on insert a unique random number

From: Vivek Khera <vivek(at)khera(dot)org>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Create on insert a unique random number
Date: 2008-03-18 17:56:37
Message-ID: 6649C6F5-BEDE-4A66-A9A3-33CE95633A83@khera.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


On Mar 18, 2008, at 1:03 PM, Campbell, Lance wrote:

> The field n is not random but is sequential. Is there something I
> should do to make the serial number random?

Depending on your "randomness" need, you can alter the increment of
the sequence so it changes by a different amount than "1" on every
increment, though it will still be constant increment.

You need to specify what the purpose of it being random is, then you
might get more useful responses. Does it need to be random for some
security purpose? If so, describe the level of security,
specifically, against what threat are you defending?

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2008-03-18 17:57:40 Re: Create on insert a unique random number
Previous Message D'Arcy J.M. Cain 2008-03-18 17:38:24 Re: Create on insert a unique random number