Use EXCLUSIVE MODE when locking PostgreSQL tables.

Previous implementation used ACCESS EXCLUSIVE MODE (PostgreSQL's default) which
does not allow SELECTs on the locked table. This is too pessimistic so it's been
replaced by a plain EXCLUSIVE MODE which still blocks INSERTs and UPDATEs
but not SELECTs.

review1011002
issue2280
This commit is contained in:
Albert Cervera i Areny committed 2013-12-19 20:58:13 +01:00
1 parent f52fe8e45f
commit ce781a5d0e
1 file changed
+1 -1
+1 -1
View File
@@ -353,7 +353,7 @@ class Cursor(CursorInterface):
return self.cursor.fetchone()[0]
def lock(self, table):
self.cursor.execute('LOCK "%s"' % table)
self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE' % table)
def has_constraint(self):
return True