Is a randomized default value primary key possible?

Поиск
Список
Период
Сортировка
От April L
Тема Is a randomized default value primary key possible?
Дата
Msg-id 3.0.5.32.20020519121004.06db8ec8@mail.i-netco.com
обсуждение исходный текст
Ответ на Re: Some CSV file-import questions  (Andrew McMillan <andrew@catalyst.net.nz>)
Ответы Re: Is a randomized default value primary key possible?
Re: Is a randomized default value primary key possible?
Список pgsql-novice
After reading about data types, create table, and other search results for
"default" and "random" in the postgres idocs, I haven't found a way to do
this:

Instead of a sequentially auto-incrementing primary key, I would like a
random 16 byte character value (assumedly hex) to be automatically created
as the default value for each new record.

I guess I could just use a large random number, created with the postgres
random() function - however I don't see any way of seeding it, or know if
that is necessary.

The purpose of using a random rather than sequential number is to prevent
people being able to access other's records by guessing.

Has anyone else encountered this challenge, and do you know of a way to
generate a random default value for the primary key?

Thank you,

- April

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

Предыдущее
От: Andrew McMillan
Дата:
Сообщение: Re: Some CSV file-import questions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Forgotten the master password of db