[Rt-devel] Postgres performance issues and some "odd" ways to
get IDs...
Joby Walker
joby at u.washington.edu
Mon Aug 14 13:38:26 EDT 2006
Andrew Sullivan wrote:
> On Mon, Aug 14, 2006 at 10:03:36AM -0700, Joby Walker wrote:
>> Jesse,
>>
>> The new behavior seems very broken:
>>
>> 1) Insert row (sequence nextval returns x)
>> 2) get current value of sequence (returns x)
>>
>> As far as I can see SearchBuilder doesn't wrap a transaction around the
>> Insert sub so you could end up with unpredictable results:
>
> No, you can't, even without explicit BEGIN; . . . COMMIT; Please
> see the Postgres docs on nextval() an currval(). But the basic thing
> is that currval() is private to _your connection_, not to your
> transaction.
>
> A
>
Your absolutely right. Thanks for correcting me! Looks like currval is
safer than I thought...
More information about the Rt-devel
mailing list