Re: [URGENT] How to generata a unique string id

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: [URGENT] How to generata a unique string id
Дата
Msg-id 006401c0e547$499f76c0$1001a8c0@archonet.com
обсуждение исходный текст
Ответ на [URGENT] How to generata a unique string id  (Manuel Durán Aguete <mdaguete@alsernet.es>)
Список pgsql-general
From: "Manuel Durán Aguete" <mdaguete@alsernet.es>

> I need to generate a unique four letters string (p.e
> AAAA,AAAB) for any tuple I insert into a table, any idea ? How can I do
> this ?

Create a sequence foo_seq and then set your field

create table example (
  id default myfunc(nextval(foo_seq)),
  a text,
  b int4
);

Define myfunc to convert the integer into a character string (take the value
mod 26, append to string, divide value by 26, repeat)

- Richard Huxton


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Bitwise operators in SQL
Следующее
От: "Eric G. Miller"
Дата:
Сообщение: Re: Trouble with strange OUTER JOIN syntax