Re: Create on insert a unique random number - Mailing list pgsql-sql

From paul rivers
Subject Re: Create on insert a unique random number
Date
Msg-id 47DFFCE9.8000307@gmail.com
Whole thread Raw
In response to Re: Create on insert a unique random number  ("Campbell, Lance" <lance@uiuc.edu>)
List pgsql-sql
Campbell, Lance wrote:
> I created the following table:
>
> create table xyz (
> n serial, 
> abc character varying, 
> constraint n_pkey primary key (n));
>
> Each time I do an insert:
>
> insert into xyz(abc) values('adf6');
>
> The field n is not random but is sequential.  Is there something I
> should do to make the serial number random?
>
> Thanks,
>
>
>   

Why do you want a random number? Would a guid work?

Paul



pgsql-sql by date:

Previous
From: "Campbell, Lance"
Date:
Subject: Re: Create on insert a unique random number
Next
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: Create on insert a unique random number