Re: Select for update / deadlock possibility?

2018-01-02 Thread Tom Lane
Jeff Janes writes: > On Tue, Jan 2, 2018 at 3:22 AM, Durumdara wrote: >> Is "select for update" atomic (as transactions) or it isn't? > It is atomic, but you do have to worry about deadlocks. I think by "atomic" the OP intends "all the row locks are

Re: Select for update / deadlock possibility?

2018-01-02 Thread Durumdara
Dear Jeff! So. I start this question from more far. I need to protect some resources. All modifications started with StartTransaction. Then I try to lock the articles by ids (to prevents other client's modifications). After that I insert / modify needed data. Then I commit or rollback. The locks

Re: Select for update / deadlock possibility?

2018-01-02 Thread Jeff Janes
On Tue, Jan 2, 2018 at 3:22 AM, Durumdara wrote: > Dear Members! > > I have to ask something that not clear for me from description, and I > can't simulate it. > > Is "select for update" atomic (as transactions) or it isn't? > > I want to avoid the deadlocks. > > If it's

Re: Select for update / deadlock possibility?

2018-01-02 Thread Durumdara
Hello! Read Committed. I extend the example: the concurrent connections are in transactions. begin select ... for update; end; Regards dd 2018-01-02 12:31 GMT+01:00 Rakesh Kumar : > > Shouldn't isolation level also matter ? What is the isolation level you >

Re: Select for update / deadlock possibility?

2018-01-02 Thread Rakesh Kumar
Shouldn't isolation level also matter ?  What is the isolation level you are using ?