Re: function for creating random id

Поиск
Список
Период
Сортировка
От Michael Loftis
Тема Re: function for creating random id
Дата
Msg-id 3CBBAE16.1020208@wgops.com
обсуждение исходный текст
Ответ на function for creating random id  (Moritz Sinn <moritz@freesources.org>)
Ответы Re: function for creating random id  (Moritz Sinn <moritz@freesources.org>)
Список 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@freesources.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
>



В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: 'cluster' messes up a table
Следующее
От: Maurice Balick
Дата:
Сообщение: index problem (uses one index but not the other)