Skip site navigation (1) Skip section navigation (2)

Re: Create on insert a unique random number

From: paul rivers <rivers(dot)paul(at)gmail(dot)com>
To: "Campbell, Lance" <lance(at)uiuc(dot)edu>
Cc: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Create on insert a unique random number
Date: 2008-03-18 17:33:29
Message-ID: 47DFFCE9.8000307@gmail.com (view raw or flat)
Thread:
Lists: 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


In response to

pgsql-sql by date

Next:From: D'Arcy J.M. CainDate: 2008-03-18 17:38:24
Subject: Re: Create on insert a unique random number
Previous:From: Campbell, LanceDate: 2008-03-18 17:03:31
Subject: Re: Create on insert a unique random number

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group