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

2022-10-11 Thread Michael Paquier
On Sat, Jul 30, 2022 at 04:21:07PM +0900, Michael Paquier wrote: > FWIW, I find the result set approach more intuitive and robust, > particularly in the case of a sequence has non-default values > INCREMENT and min/max values. This reduces the dependency of what an > application needs to know

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

2022-07-30 Thread Michael Paquier
On Thu, Jul 28, 2022 at 12:47:10PM -0400, Tom Lane wrote: > Actually, on further thought, I do like the resultset idea, because > it'd remove the need for a complex rewrite of nextval_internal. > Assuming the SRF is written in ValuePerCall style, each iteration > can just call nextval_internal

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

2022-07-28 Thread Tom Lane
I wrote: > I've got no strong opinion about this bit: >> As suggested upthread, returning a resultset would probably be better. Actually, on further thought, I do like the resultset idea, because it'd remove the need for a complex rewrite of nextval_internal. Assuming the SRF is written in

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

2022-07-28 Thread Tom Lane
Ronan Dunklau writes: > The problem the author wants to solve is the fact they don't have a way of > returning the ids when using COPY FROM. Pre-allocating them and assigning > them > to the individual records before sending them via COPY FROM would solve that > for them. True. I took a

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

2022-07-13 Thread Ronan Dunklau
> It is Friday here, so I would easily miss something.. It is possible > to use COPY FROM with a list of columns, so assuming that you could > use a default expression with nextval() or just a SERIAL column not > listed in the COPY FROM query to do the job, what do we gain with this > feature?

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

2022-07-08 Thread Michael Paquier
On Thu, Mar 03, 2022 at 10:21:05AM +0100, Jille Timmermans wrote: > I'm using https://pkg.go.dev/github.com/jackc/pgx/v4#Conn.CopyFrom, which > uses the COPY FROM protocol but doesn't actually have to originate from a > file. It is Friday here, so I would easily miss something.. It is possible

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

2022-07-08 Thread Ronan Dunklau
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

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

2022-07-01 Thread Jille Timmermans
On 2022-04-08 15:33, Greg Stark wrote: On Sun, 27 Feb 2022 at 07:09, Jille Timmermans wrote: First time PostgreSQL contributor here :) I wish I had noticed this patch during the CF. It seems like a nice self-contained feature that could have been easily reviewed and committed and it's always

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

2022-04-08 Thread Greg Stark
On Sun, 27 Feb 2022 at 07:09, Jille Timmermans wrote: > > Hi, > > First time PostgreSQL contributor here :) I wish I had noticed this patch during the CF. It seems like a nice self-contained feature that could have been easily reviewed and committed and it's always good to see first-time

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

2022-03-03 Thread Jille Timmermans
On 2022-03-03 10:10, Peter Eisentraut wrote: On 02.03.22 20:12, Jille Timmermans wrote: On 2022-02-28 11:13, Peter Eisentraut wrote: On 27.02.22 10:42, Jille Timmermans wrote: I wanted to be able to allocate a bunch of numbers from a sequence at once. Multiple people seem to be struggling

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

2022-03-03 Thread Peter Eisentraut
On 02.03.22 20:12, Jille Timmermans wrote: On 2022-02-28 11:13, Peter Eisentraut wrote: On 27.02.22 10:42, Jille Timmermans wrote: I wanted to be able to allocate a bunch of numbers from a sequence at once. Multiple people seem to be struggling with this

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

2022-03-02 Thread Jille Timmermans
On 2022-02-28 11:13, Peter Eisentraut wrote: On 27.02.22 10:42, Jille Timmermans wrote: I wanted to be able to allocate a bunch of numbers from a sequence at once. Multiple people seem to be struggling with this

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

2022-02-28 Thread Peter Eisentraut
On 27.02.22 10:42, Jille Timmermans wrote: 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,

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

2022-02-27 Thread Jille Timmermans
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

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

2022-02-27 Thread Julien Rouhaud
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 >

Support for grabbing multiple consecutive values with nextval()

2022-02-27 Thread Jille Timmermans
Hi, 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 (https://stackoverflow.com/questions/896274/select-multiple-ids-from-a-postgresql-sequence,