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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

  From Date Subject
Next Message A. Kretschmer 2008-03-27 09:52:20 Re: Ignore unique violations?
Previous Message A B 2008-03-27 09:45:33 Ignore unique violations?