Re: Reserve a value in a serial type field

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Reserve a value in a serial type field
Date: 2007-01-16 05:00:23
Message-ID: 20070116050023.GA26210@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

am Mon, dem 15.01.2007, um 10:57:17 -0800 mailte Albert folgendes:
> Hi all. I have this issue: I need to load a value for an integer field
> (with auto increment) which I implemented with a serial type and to
> avoid inserts with that value in this field. The task is for a
> distributed program I'm creating and I wonder if there is an efficient
> solution for it.
>
> I thought about setting the current value of the sequence when loading
> the needed value..is it a solution? Is there something more efficient?

A squence with a gap?

See http://a-kretschmer.de/diverses.shtml -> "A Sequence with a gap".

I hope this can solve your problem.

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

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-01-16 05:26:05 Re: Improve Postgres Query Speed
Previous Message Chris 2007-01-16 04:19:11 Re: Improve Postgres Query Speed