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

Re: Create on insert a unique random number

From: hubert depesz lubaczewski <depesz(at)depesz(dot)com>
To: "Campbell, Lance" <lance(at)uiuc(dot)edu>
Cc: Vivek Khera <vivek(at)khera(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Create on insert a unique random number
Date: 2008-03-19 09:59:41
Message-ID: 20080319095941.GB14712@depesz.com (view raw or flat)
Thread:
Lists: pgsql-sql
On Tue, Mar 18, 2008 at 01:40:42PM -0500, Campbell, Lance wrote:
> This is not a security approach.  It is more about not giving obvious
> access to people that want to mess around.

1. keep primary key using standard serial. it will make your life a bit
simpler.
2. add column for text random identifiers (it doesn't have to be number,
and adding characters makes for much better "randomness").
3. check this:
http://www.depesz.com/index.php/2007/06/25/random-text-record-identifiers/

depesz

-- 
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA.  here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)

In response to

pgsql-sql by date

Next:From: D'Arcy J.M. CainDate: 2008-03-19 13:47:53
Subject: Re: Create on insert a unique random number
Previous:From: Tom LaneDate: 2008-03-19 03:01:53
Subject: Re: pg_dump using SQL

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