Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id C061D475A9A for ; Thu, 2 May 2002 07:01:24 -0400 (EDT) Received: from www1.translationforge.com (unknown [212.11.36.58]) by postgresql.org (Postfix) with ESMTP id 88E46475A77 for ; Thu, 2 May 2002 07:01:23 -0400 (EDT) Received: from linus.translationforge.com ([192.168.1.102]) by www1.translationforge.com (8.12.1/8.12.1) with ESMTP id g42B1PKO032441; Thu, 2 May 2002 13:01:25 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Jean-Michel POURE Reply-To: jm.poure@freesurf.fr To: postgres@vrane.com Subject: Re: HOWTO - Random character generation for primary key Date: Thu, 2 May 2002 13:01:22 +0200 X-Mailer: KMail [version 1.4] References: <20020502020148.35486.qmail@web21203.mail.yahoo.com> <200205021158.53937.jm.poure@freesurf.fr> <20020502061317.A4832@amd.universe> In-Reply-To: <20020502061317.A4832@amd.universe> Cc: pgsql-general@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200205021301.22897.jm.poure@freesurf.fr> X-Archive-Number: 200205/52 X-Sequence-Number: 24032 Le Jeudi 2 Mai 2002 12:13, postgres@vrane.com a =E9crit : > > Le Jeudi 2 Mai 2002 11:30, postgres@vrane.com a =E9crit : > > > Untrue. I am using email addresses > > > as primary keys in a table. Where > > > did you get that information? > >=20 > > 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 rand= om > > values.=20 > > 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=20 random_string(200) value should provide a unique signature. What do you=20 think? Alternatively, could we use the crypto package to generate a unique= =20 signature? Cheers, Jean-Michel POURE