Support for grabbing multiple consecutive values with nextval()

From: Jille Timmermans <jille(at)quis(dot)cx>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Support for grabbing multiple consecutive values with nextval()
Date: 2022-02-27 09:42:25
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


First time PostgreSQL contributor here :)

I wanted to be able to allocate a bunch of numbers from a sequence at
once. Multiple people seem to be struggling with this

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?).

-- Jille

Attachment Content-Type Size
0001-Add-an-argument-to-nextval-to-grab-multiple-consecut.patch text/x-diff 9.2 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-02-27 09:46:44 Re: Is it worth adding ReplicationSlot active_pid to ReplicationSlotPersistentData?
Previous Message Julien Rouhaud 2022-02-27 09:29:19 Re: Checkpointer sync queue fills up / loops around pg_usleep() are bad