dbTalk Databases Forums  

Re: multiple statements.. and locking

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Re: multiple statements.. and locking in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tom Lane
 
Posts: n/a

Default Re: multiple statements.. and locking - 04-05-2004 , 11:31 PM






Benjamin <benjamin (AT) netyantra (DOT) com> writes:
Quote:
I have a C application. I have to modify a row in a table, n then
immediately access a field in that row.
These operation of modifying and accessing has to be atomic.So, i have
to lock the row.
The UPDATE in your example does that already; I think you should just
drop the LOCK ...

Quote:
BEGIN; LOCK TABLE tablename in ROW EXCLUSIVE MODE; UPDATE tablename set
colname=value WHERE rowprimary='a' ; SELECT b from tablename WHERE
rowprimary='a'; COMMIT;
regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.