From: | Michael Loftis <mloftis(at)wgops(dot)com> |
---|---|
To: | Bruno Wolff III <bruno(at)wolff(dot)to> |
Cc: | Moritz Sinn <moritz(at)freesources(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: function for creating random id |
Date: | 2002-04-16 04:52:38 |
Message-ID: | 3CBBAE16.1020208@wgops.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I've gotten intot he habit of using a sequence identifier, and couple
that with the current time then md5 sum that to create unique uids.
Works our fairly well, and is atleast marginally difficult to guess.
Bruno Wolff III wrote:
>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.
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/users-lounge/docs/faq.html
>
From | Date | Subject | |
---|---|---|---|
Next Message | Maurice Balick | 2002-04-16 05:35:18 | index problem (uses one index but not the other) |
Previous Message | Bruce Momjian | 2002-04-16 04:46:12 | Re: 'cluster' messes up a table |