Re: Support for grabbing multiple consecutive values with nextval() - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: Support for grabbing multiple consecutive values with nextval()
Date
Msg-id 20220227132250.hdtkvb46qgy5rvly@jrouhaud
Whole thread Raw
In response to Support for grabbing multiple consecutive values with nextval()  (Jille Timmermans <jille@quis.cx>)
Responses Re: Support for grabbing multiple consecutive values with nextval()
List pgsql-hackers
Hi,

On Sun, Feb 27, 2022 at 10:42:25AM +0100, Jille Timmermans wrote:
>
> First time PostgreSQL contributor here :)

Welcome!

> I wanted to be able to allocate a bunch of numbers from a sequence at once.
> Multiple people seem to be struggling with this
(https://stackoverflow.com/questions/896274/select-multiple-ids-from-a-postgresql-sequence,
> https://www.depesz.com/2008/03/20/getting-multiple-values-from-sequences/).
>
> I propose to add an extra argument to nextval() that specifies how many
> numbers you want to allocate (default 1).
>
> The attached patch (based on master) passes `./configure --enable-cassert
> --enable-debug && make && make check`, including the newly added regression
> tests.
>
> It does change the signature of nextval_internal(), not sure if that's
> considered backwards compatibility breaking (for extensions?).

Please register this patch to the next commit fest (and last for pg15
inclusion) at https://commitfest.postgresql.org/37/ if not done already.



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_stat_statements: remove redundant function call in pg_stat_statements_internal
Next
From: "Gunnar \"Nick\" Bluth"
Date:
Subject: Re: PATCH: add "--config-file=" option to pg_rewind