Re: SEQUENCE values (duplicated) in some corner cases when crash happens

2020-05-14 Thread Alvaro Herrera
On 2020-May-14, Jeremy Schneider wrote: > "Later stored it in the table" - I'd have to double check with the other > team, but IIUC it was application pseudo-code like this: > > * execute SQL "select nextval()" and store result in > my_local_variable_unique_id > * commit Yes, simply inse

Re: SEQUENCE values (duplicated) in some corner cases when crash happens

2020-05-14 Thread Jeff Janes
On Wed, May 6, 2020 at 1:52 PM Jeremy Schneider wrote: > The behavior we're observing is that a nextval() call in a committed > transaction is not crash-safe. This was discovered because some > applications were using nextval() to get a guaranteed unique sequence > number [or so they thought], t

Re: SEQUENCE values (duplicated) in some corner cases when crash happens

2020-04-29 Thread Tom Lane
Alvaro Herrera writes: > On 2020-Apr-29, Vinicius Abrahao wrote: >> I'm opening this thread to clarify something that I can observe: duplicated >> values for sequences. > I'm not sure that a sequence that produces the same value twice, without > writing it to the database the first time, and with

Re: SEQUENCE values (duplicated) in some corner cases when crash happens

2020-04-29 Thread Alvaro Herrera
On 2020-Apr-29, Vinicius Abrahao wrote: > Hello PG Hackers > > Hope you are well and safe! > > I'm opening this thread to clarify something that I can observe: duplicated > values for sequences. > > [My understanding is that duplication is not something we desire. In fact > it does NOT happen i