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

From Ronan Dunklau
Subject Re: Support for grabbing multiple consecutive values with nextval()
Date
Msg-id 2516352.Lt9SDvczpP@aivenronan
Whole thread Raw
In response to Re: Support for grabbing multiple consecutive values with nextval()  (Jille Timmermans <jille@quis.cx>)
List pgsql-hackers
Hello,

Reading the thread, I think the feature has value: it would basically transfer 
control of the sequence cache to the client application.

However, I don't think that returning only the last value is a sensible thing 
to do. The client will need to know the details of the sequence to do anything 
useful about this, especially it's increment, minvalue, maxvalue and cycle 
options. 

As suggested upthread, returning a resultset would probably be better. If the 
client application is concerned about the volume of data exchanged with the 
server, and is willing to deal with handling the knowledge of the sequence 
details themselves, they can always wrap it in an aggregate:

SELECT min(newvals), max(newvals)   FROM nextvals(<num_nextvals>) as newvals

Regards,

--
Ronan Dunklau





pgsql-hackers by date:

Previous
From: Ian Lawrence Barwick
Date:
Subject: Re: Support TRUNCATE triggers on foreign tables
Next
From: Amit Kapila
Date:
Subject: Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns