title: postgresql -- Curval not working, using PHP PDO
body: <p>So I'm trying to run some SQL here through PHP's PDO (which I don't believe should be the problem) like such:</p>
  
  <pre><code>INSERT INTO example (
      d_id,
      s_id
  ) 
      VALUES (
      currval('d_id_seq'),
      currval('s_id_seq')
  );
  </code></pre>
  
  <p>I have two sequences called <code>d_id_seq</code> and <code>s_id_sec</code> (lets pretend I have a table named <code>d</code> and a table named <code>s</code>, and this sequence is a column called ID and <code>serial</code> type).</p>
  
  <p>Now, obviously I'm doing this wrong, as I get an error about the sequence not being used in this session:</p>
  
  <blockquote>
    <p>Object not in prerequisite state: 7 ERROR:  currval of sequence "d_id_seq" is not yet defined in this session</p>
  </blockquote>
  
  <p>So, how should I write this?</p>