Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group