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

Re: Reuse serial numbers?

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Reuse serial numbers?
Date: 2008-03-27 09:49:06
Message-ID: 20080327094906.GD26764@a-kretschmer.de (view raw or flat)
Thread:
Lists: pgsql-novice
am  Thu, dem 27.03.2008, um  9:36:57 +0000 mailte A B folgendes:
> Hello.
> I have a table
> create table TBL (a serial, b integer, c integer, unique(b,c));
> 
> so I for each combination of b,c get an unique number a.
> 
> Now, if the table is filled and I remove some rows, so there is a gap
> in the a numbers. Is there a way to reuse the "free" serial numbers?
> 
> I don't feel like writing a script to select all numbers and do some
> searching for free numbers.

Why do you think you need the numbers?

Normally, you don't need this, a sequence can produce sufficient
numbers.

If you really need this behavior:
http://www.varlena.com/GeneralBits/130.php


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

In response to

Responses

pgsql-novice by date

Next:From: A. KretschmerDate: 2008-03-27 09:52:20
Subject: Re: Ignore unique violations?
Previous:From: A BDate: 2008-03-27 09:45:33
Subject: Ignore unique violations?

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