Use a sequence of records, values in write

issue3499
review1641003
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