Re: [GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-21 Thread Tom Lane
Ivan Sergio Borgonovo writes: > I was mainly concerned about assigning ownership of a sequence to a > column that is not an int. I think you can get away with that. It's already the case within the standard usage that the owning column could be either int or bigint. FWIW, I agree with the idea

Re: [GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-21 Thread Ivan Sergio Borgonovo
On Thu, 20 Aug 2009 14:31:02 -0400 Alvaro Herrera wrote: > Ivan Sergio Borgonovo wrote: > > I've > > > > create table pr( > > code varchar(16) primary key, > > ... > > ); > > create sequence pr_code_seq owned by pr.code; -- uh! > > actually stuff like: > > alter table pr drop column code; >

Re: [GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-20 Thread Alvaro Herrera
Ivan Sergio Borgonovo wrote: > I've > > create table pr( > code varchar(16) primary key, > ... > ); > create sequence pr_code_seq owned by pr.code; -- uh! > > pr.code will *mostly* be obtained as > > to_hex(feistel_encrypt(nextval('pr_code'))) > and sometimes 'manually' inserting unique code

[GENERAL] "ownership" of sequences, pseudo random unique id

2009-08-20 Thread Ivan Sergio Borgonovo
I've create table pr( code varchar(16) primary key, ... ); create sequence pr_code_seq owned by pr.code; -- uh! pr.code will *mostly* be obtained as to_hex(feistel_encrypt(nextval('pr_code'))) and sometimes 'manually' inserting unique codes. actually stuff like: alter table pr drop column c