From: "Manuel Durán Aguete" <mdaguete(at)alsernet(dot)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