title: Postgres not returning lastval() properly
body: <p>I am trying to insert a new user into our database, via psql in the CLI. When I do the following:</p>
  
  <pre><code>START TRANSACTION;
  INSERT INTO "users" ("email", "first_name", "last_name", "password", "objectstate_id", "activate_rid")
  VALUES ('xpress@carepilot.com', 'Xpress', 'Care', 'f9fecdd84ee071806423adf30d6d6ff04e1a0a2c6688f2c057ddbab1d6b55d02', 4, 'EMQHTMMvViAB5BdYj0E6');
  SELECT LASTVAL();
  </code></pre>
  
  <p><code>LASTVAL</code> always returns 39037, which should technically be 838. It is also not inserting it into the DB for some reason. I have googled and looked for everything that I can think of and am not getting any answers. Does anyone have any idea what is going on here?</p>