Re: BUG #3811: Getting multiple values from a sequence generator

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Adriaan van Os <postgres(at)microbizz(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3811: Getting multiple values from a sequence generator
Date: 2007-12-09 15:32:17
Message-ID: 1197214337.4255.814.camel@ebony.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Sun, 2007-12-09 at 09:24 +0000, Adriaan van Os wrote:
> The following bug has been logged online:
>
> Bug reference: 3811
> Logged by: Adriaan van Os
> Email address: postgres(at)microbizz(dot)nl
> PostgreSQL version: 8.2.5
> Operating system: Mac OS X 10.5
> Description: Getting multiple values from a sequence generator
> Details:
>
> The following has been observed In Postgres 8.2.5
>
> 1. LOCK TABLE doesn't work on a sequence
> 2. nextval will happily ignore ISOLATION LEVEL SERIALIZABLE of concurrent
> transactions
> 3. nextval doesn't have an optional "increase" parameter (the increase is
> always one).
>
> Therefore, there is no way (I know of) to prevent a concurrent nextval
> between a nextval and a setval call. Consequently, it is not possible to
> create an atomic operation that increases nextval by a value N > 1.
>
> I suggest an optional "increase" parameter to the nextval function. This can
> make a certain kind of bulk operation and bulk import much more efficient.

ALTER SEQUENCE blah INCREMENT BY val;

--
Simon Riggs
2ndQuadrant http://www.2ndQuadrant.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Gregory Stark 2007-12-10 01:12:21 Re: BUG #3811: Getting multiple values from a sequence generator
Previous Message Michael Glaesemann 2007-12-09 13:18:01 Re: BUG #3811: Getting multiple values from a sequence generator

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2007-12-09 16:26:43 Re: PGparam timestamp question
Previous Message Bruce Momjian 2007-12-09 15:19:36 Re: Release Note Changes