title: Returning result from SELECT with node-postgres
body: <p>Having trouble getting results back from SELECT queries in node-postgres. Now rows are empty at the end of the codeblock. This select just returns a next value from a sequence in POSTGRESQL. I know that you can not retrieve results from callback, but are there anyone here who have used node-postgres(or any other database modules to node) that might know a fix? </p>
  
  <pre><code>client.connect();
  var query = client.query("SELECT nextval(\'idgenerator\');");
  var rows = [];
  query.on('row', function(row, res) {
      rows.push(row);
  });
  query.on('end', function(result) {
      console.log(result.rowCount + ' rows were received');
  });
  //client.end();
  console.log(rows);
  </code></pre>