Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Jdbc > Re: Retrieving ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 16 of 18 Topic 1882 of 2010
Post > Topic >>

Re: Retrieving last InsertedID : INSERT... RETURNING safe ?

by pg@[EMAIL PROTECTED] (Dave Cramer) Feb 20, 2008 at 09:02 AM

On 20-Feb-08, at 8:41 AM, Paul Tomblin wrote:

> On Feb 20, 2008 8:32 AM, Dave Cramer <pg@[EMAIL PROTECTED]
> wrote:
>> As far as I can tall Paul has inherited an application which uses a
>> single connection for all database operations, and is a swing app
>> which has callbacks which do the following
>>
>> Callback code
>>
>>        grab the global connection object
>>        create a statement
>>        do something
>>        close statement
>>
>> in this scenario, since currval has connection scope if two callbacks
>> are called at the same time, only one will have the right answer .
>>
>> Paul am I correct in my assumptions above ?
>
> Pretty much, except with the added complication that there are a dozen
> or so daemons that are also updating the same tables, and up until now
> they've all had autocommit on.  I thought the currval had transaction
> scope not connection scope, at least that's what my testing in pgsql
> seemed to indicate, which is why I stated that autocommit was a
> problem.
>
> Are you saying that if in one connection I do a nextval and commit,
> and somebody else in a different connection does a hundred nextvals
> and commits, then 20 minutes later I do the currval I'll get the one
> from my old transaction?
Yes it has connection scope, not transaction scope. currval stores the  
current value in connections memory.
>
>
>
>
> -- 
> For my assured failures and derelictions I ask pardon beforehand of my
> betters and my equals in my Calling here assembled, praying that in
> the hour of my temptations, weakness and weariness, the memory of this
> my Obligation and of the company before whom it was entered into, may
> return to me to aid, comfort and restrain.
>
> ---------------------------(end of  
> broadcast)---------------------------
> TIP 7: You can help sup****t the PostgreSQL project by donating at
>
>                http://www.postgresql.org/about/donate


---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq
 




 18 Posts in Topic:
Retrieving last InsertedID : INSERT... RETURNING safe ?
spastor@[EMAIL PROTECTED]  2008-02-20 10:44:37 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
heikki@[EMAIL PROTECTED]   2008-02-20 11:11:50 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
gc@[EMAIL PROTECTED] (Gu  2008-02-20 12:37:44 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
davec@[EMAIL PROTECTED]   2008-02-20 06:53:30 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
pg@[EMAIL PROTECTED] (Da  2008-02-20 06:54:20 
Re: Retrieving last InsertedID : INSERT... RETURNING safe
ptomblin@[EMAIL PROTECTED  2008-02-20 07:19:16 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
pg@[EMAIL PROTECTED] (Da  2008-02-20 07:28:18 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
heikki@[EMAIL PROTECTED]   2008-02-20 13:14:00 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
pg@[EMAIL PROTECTED] (Da  2008-02-20 08:32:42 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
heikki@[EMAIL PROTECTED]   2008-02-20 12:27:34 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
gc@[EMAIL PROTECTED] (Gu  2008-02-20 13:01:44 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
ptomblin@[EMAIL PROTECTED  2008-02-20 08:36:32 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
heikki@[EMAIL PROTECTED]   2008-02-20 13:50:06 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
pg@[EMAIL PROTECTED] (Da  2008-02-20 08:59:55 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
ptomblin@[EMAIL PROTECTED  2008-02-20 08:41:56 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
pg@[EMAIL PROTECTED] (Da  2008-02-20 09:02:35 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
ptomblin@[EMAIL PROTECTED  2008-02-20 09:03:14 
Re: Retrieving last InsertedID : INSERT... RETURNING safe ?
heikki@[EMAIL PROTECTED]   2008-02-20 14:26:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Aug 21 22:46:24 CDT 2008.