pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: paul rivers <rivers.paul@gmail.com>
To: Campbell, Lance <lance@uiuc.edu>
Cc: A. Kretschmer <andreas.kretschmer@schollglas.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Create on insert a unique random number
Date: Tue, 18 Mar 2008 10:33:29 -0700
Message-ID: <47DFFCE9.8000307@gmail.com> (raw)
In-Reply-To: <B10E6810AC2A2F4EA7550D072CDE8760CDDC33@SAB-FENWICK.sab.uiuc.edu>
References: <B10E6810AC2A2F4EA7550D072CDE8760CDDC32@SAB-FENWICK.sab.uiuc.edu>
	<268179.51357.qm@web54301.mail.re2.yahoo.com>
	<20080318165138.GA6578@a-kretschmer.de>
	<B10E6810AC2A2F4EA7550D072CDE8760CDDC33@SAB-FENWICK.sab.uiuc.edu>

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




view thread (19+ messages)  latest in thread

Message-ID: <47DFFCE9.8000307@gmail.com>
Permalink:  ../47DFFCE9.8000307@gmail.com/
Also on:    postgresql.org/message-id/47DFFCE9.8000307@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: rivers.paul@gmail.com, lance@uiuc.edu, andreas.kretschmer@schollglas.com
  Subject: Re: Create on insert a unique random number
  In-Reply-To: <47DFFCE9.8000307@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox