Re: function for creating random id

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Moritz Sinn <moritz(at)freesources(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: function for creating random id
Date: 2002-04-15 18:49:49
Message-ID: 20020415184949.GA10684@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 15, 2002 at 05:51:53PM +0200,
Moritz Sinn <moritz(at)freesources(dot)org> wrote:
> hi,
>
> i've got a table called "user". every user should have a userid, which
> is the primary key. this userid is a random number with up to 6 digits.
>
> but now the problem is that the id which is returned by getuid() could
> already be in use.
> so what is the best method to realize that?

Do the IDs really need to be random? Is the order that users were created
in really secret information?

If they don't, you can use a sequence to allocate IDs.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-04-15 18:52:25 Re: psql and passwords
Previous Message Mike 2002-04-15 18:49:28 postgres replication