title: Where should I use done()
body: <p>I am working under mobile backend using pg with connection pooling, now I meet the problem </p>
  
  <p><strong>Error text</strong></p>
  
  <p><code>Error: connection pointer is NULL</code></p>
  
  <p>As I understand from this issue, <a href="https://github.com/brianc/node-postgres/issues/182" rel="nofollow">https://github.com/brianc/node-postgres/issues/182</a>.</p>
  
  <p>My question how <code>done()</code> works in pg, and where should I call it?</p>
  
  <p>If I have for example multiple queries should be called one by one</p>
  
  <pre><code>pg.connect("constr", function(err,client,done) {
    if (err) callback(err);
    else {
      client.query("some query", function(err, result) {
         if (err) callback(err);
         else {
            client.query("one more", function(err, result) {
               if (err) callback(err);
               else {
                  callback(null, result);
               }
            });
         }
      });
    }
  });
  </code></pre>
  
  <p>Please explain me <code>done()</code> on this example.</p>