title: PostgreSQL transaction lock
body: <p>I'm using pg, pg-native for my project, I use transaction something like below code, I'm not familiar with database,<br>
  <a href="https://github.com/brianc/node-postgres/wiki/Transactions" rel="nofollow noreferrer">https://github.com/brianc/node-postgres/wiki/Transactions</a><br>
  1. Does this lock table or only lock the row?<br>
  2. The lock does it means diable <code>Create</code>, <code>Update</code>, <code>Delete</code> in <code>CRUD</code>. but still can be <code>Read</code>? if so, the data be select, is it the data before this change (before <code>BEGIN</code>)?</p>
  
  <p>"pg": "^4.5.1",
  "pg-native": "^1.10.0",</p>
  
  <pre><code>var pg = require('pg').native;
  ...
  
  var rollback = function(dbClient, response) {
    dbClient.query('ROLLBACK', function() {
      dbClient.end();
      // reject(response);
    });
  };
  
  dbClient.query('BEGIN', function(error, result) {
    ...
  
  dbClient.query('COMMIT', dbClient.end.bind(dbClient));
    ...
  </code></pre>