[Twisted-Python] PyPgSQL not locking in adbapi

Carolina Ardohain carolinaardohain at gmail.com
Wed Jun 1 15:27:54 EDT 2005


I'm using Twisted 2.0, and pgSQL 2.4.

I have two function in plpgsql that access the same table, I have to
look if one id is in the table persons, if not then add to the table.
I try to lock a table with "LOCK TABLE persons IN ACCESS EXCLUSIVE
MODE;", so no both functions try to add the same id.

I get 'duplicate key violates unique constraint' when run the two
queries at the same time, if I delay one of the functions 1 sec then
everything is fine.




More information about the Twisted-Python mailing list