Re: function for creating random id

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: function for creating random id
Дата
Msg-id 20020415184949.GA10684@wolff.to
обсуждение исходный текст
Ответ на function for creating random id  (Moritz Sinn <moritz@freesources.org>)
Ответы Re: function for creating random id  (Moritz Sinn <moritz@freesources.org>)
Список pgsql-general
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.

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

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Alter/update large tables - VERRRY annoying behaviour!
Следующее
От: Tom Lane
Дата:
Сообщение: Re: psql and passwords