pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean-Michel POURE <jm.poure@freesurf.fr>
To: postgres@vrane.com
Cc: pgsql-general@postgresql.org
Subject: Re: HOWTO - Random character generation for primary key
Date: Thu, 2 May 2002 13:01:22 +0200
Message-ID: <200205021301.22897.jm.poure@freesurf.fr> (raw)
In-Reply-To: <20020502061317.A4832@amd.universe>
References: <20020502020148.35486.qmail@web21203.mail.yahoo.com>
	<200205021158.53937.jm.poure@freesurf.fr>
	<20020502061317.A4832@amd.universe>

Le Jeudi 2 Mai 2002 12:13, postgres@vrane.com a écrit :
> > Le Jeudi 2 Mai 2002 11:30, postgres@vrane.com a écrit :
> > > Untrue.  I am using email addresses
> > > as primary keys in a table.  Where
> > > did you get that information?
> > 
> > Sorry, I did not mean that of course. I posted this small howto in reply
> > to a mail. It shows how to create a VACHAR PRIMARY KEY with unique random
> > values. 
> > On 10 character lenght, there is approximatively one chance out of 26^10
> > to have a similar value. If you add a string timestamp, like
> > "20020501_1153_" in front of the random value, it is very likely that
> > this value will be UNIQUE in the word:
>
> In the real world "very likely" is not good enough.  Can you gurantee
> 'uniqueness'?

A timestamp (ex: 20020501_1258) followed by PLpgSQL function 
random_string(200) value should provide a unique signature. What do you 
think? Alternatively, could we use the crypto package to generate a unique 
signature?

Cheers,
Jean-Michel POURE



view thread (5+ messages)  latest in thread

Message-ID: <200205021301.22897.jm.poure@freesurf.fr>
Permalink:  ../200205021301.22897.jm.poure@freesurf.fr/
Also on:    postgresql.org/message-id/200205021301.22897.jm.poure@freesurf.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jm.poure@freesurf.fr, postgres@vrane.com, pgsql-general@postgresql.org
  Subject: Re: HOWTO - Random character generation for primary key
  In-Reply-To: <200205021301.22897.jm.poure@freesurf.fr>
  References: <20020502020148.35486.qmail@web21203.mail.yahoo.com> <200205021158.53937.jm.poure@freesurf.fr> <20020502061317.A4832@amd.universe> <200205021301.22897.jm.poure@freesurf.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox