pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. Kretschmer <andreas.kretschmer@schollglas.com>
To: pgsql-sql@postgresql.org
Subject: Re: Create on insert a unique random number
Date: Tue, 18 Mar 2008 18:57:40 +0100
Message-ID: <20080318175740.GA7657@a-kretschmer.de> (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>

am  Tue, dem 18.03.2008, um 12:03:31 -0500 mailte Campbell, Lance folgendes:
> 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?

Why do you mean to need a random value? But you can use something like
md5(nextval('your_sequence')) as default. But i can't see an advantage.


>  
> 
> -----Original Message-----

Please, no top-posting. I'm reading from top to bottom.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net



view thread (19+ messages)  latest in thread

Message-ID: <20080318175740.GA7657@a-kretschmer.de>
Permalink:  ../20080318175740.GA7657@a-kretschmer.de/
Also on:    postgresql.org/message-id/20080318175740.GA7657@a-kretschmer.de

 · 

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: andreas.kretschmer@schollglas.com
  Subject: Re: Create on insert a unique random number
  In-Reply-To: <20080318175740.GA7657@a-kretschmer.de>

* 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