Search Postgresql Archives

Re: Are rules transaction safe?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oliver Fürst wrote:
'currval()' is specifically written to Do The Right Thing.  See the
docs.

My problem isn't answered in the manual, otherwise I wouldn't have asked. I know that sequences are working correct for transactions (either implicit or explicit).

But is nowhere stated if (multiple) commands inside a rule are treated as an implicit transaction as a whole.

Sequences aren't related to transactions the way you seem to think. Every time you request a nextval, no matter in what transaction you are, you get a new value (higher, with the exception of the wraparound case).

I suppose currval always matches the last result of nextval in your transaction (as manipulated by your queries). Can't say I'm certain, but that's something that can easily be tested.

I don't know the implementation details of sequences in PostgreSQL, but that's how sequences are supposed to work. They do (as stated before) "The Right Thing". You don't need to worry about them.

--
Alban Hertroys
alban@xxxxxxxxxxxxxxxxx

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
   7500 AK Enschede

//Showing your Vision to the World//



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux