Re: Support for grabbing multiple consecutive values with nextval()

From: Jille Timmermans <jille(at)quis(dot)cx>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Support for grabbing multiple consecutive values with nextval()
Date: 2022-02-27 14:27:38
Message-ID: c60509cc3c978400d80efdf4b7b38b44@quis.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2022-02-27 14:22, Julien Rouhaud wrote:
> Hi,
>
> On Sun, Feb 27, 2022 at 10:42:25AM +0100, Jille Timmermans wrote:
>>
>> First time PostgreSQL contributor here :)
>
> Welcome!
Thanks!

>
>> 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.
Done: https://commitfest.postgresql.org/37/3577/ (I was waiting for
mailman approval before I got the thread id.)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-02-27 15:14:39 Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs)
Previous Message Japin Li 2022-02-27 14:13:13 CREATE DATABASE IF NOT EXISTS in PostgreSQL