Re: List last value of all sequences
От | greg@turnstep.com |
---|---|
Тема | Re: List last value of all sequences |
Дата | |
Msg-id | aa695fccd4f3f2ee39be3abf1a789738@biglumber.com обсуждение исходный текст |
Ответ на | Re: List last value of all sequences (Stephan Szabo <sszabo@megazone.bigpanda.com>) |
Список | pgsql-general |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Stephan Szabo wrote: > I'm not sure, but if another transaction wanted to do a nextval at "the > same time" couldn't the sequence of events end up going something like: > > T1: nextval > T2: nextval > T1: setval(currval-1) *shrug* It's possible, though perhaps unlikely, as transaction 2 has a /very/ small window in which to wreak its havok. I like the function solution better anyway; consider the pure SQL one an academic exercise. :) Berend Tober said: > I guess nothing beats empirical evidence! I was basing my comments on my > (mis?)understanding of what the documentation says. My query should match the docs. I'm getting the next value, which increments the sequence by one, then I set the sequence to one less than the value I just grabbed, so it should be back in its initial state. So, we are both correct: I am changing the value, and it stays the same. Aren't sequences fun? :) - -- Greg Sabino Mullane greg@turnstep.com PGP Key: 0x14964AC8 200307241716 -----BEGIN PGP SIGNATURE----- Comment: http://www.turnstep.com/pgp.html iD4DBQE/IE1XvJuQZxSWSsgRApJsAJdha8ZoVJi0QYxRK/2hgnZKLObyAJ4gkBJI 349WNU+i+5j6WttaGcgKtw== =C0O+ -----END PGP SIGNATURE-----
В списке pgsql-general по дате отправления: