<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 13-08-22 08:59 AM, Sean Hogan wrote:<br>
    </div>
    <blockquote cite="mid:5215F61A.6050402@compusult.net" type="cite">
      <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 13-08-21 08:23 PM, Tatsuo Ishii
        wrote:<br>
      </div>
      <blockquote
        cite="mid:20130822.075341.2182430226914513670.t-ishii@sraoss.co.jp"
        type="cite">
        <blockquote type="cite"> Ah, I believe I understand the problem
          now: the sequence values are different (off by one) between
          the original and recovered databases. The sample
          pgpool_sample_pitr script has: SELECT setval(oid,
          nextval(oid)) FROM pg_class WHERE relkind = 'S' When I change
          that to SELECT setval(oid, 1*currval(oid)) FROM pg_class WHERE
          relkind = 'S' I get identical databases and the problem has
          not reoccurred! (The "1*" is to defeat optimization; not sure
          if it is needed.) Thanks for your excellent advice. </blockquote>
        <pre wrap="">Thanks for the report but your changes seems a little bit strange to
me. According to the PostgreSQL manual, calling currval() without
prior calling nextval() will raise an error. Don't you get any error?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.sraoss.co.jp/index_en.php">http://www.sraoss.co.jp/index_en.php</a>
Japanese: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.sraoss.co.jp">http://www.sraoss.co.jp</a>
</pre>
      </blockquote>
      <br>
      That's interesting, I was unaware of that restriction on currval. 
      Indeed if I run the script manually I do get an error.  Now I'm
      quite confused, because the overall effect is what I need.  Based
      on the manual page at
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <a moz-do-not-send="true"
        href="http://www.postgresql.org/docs/9.2/static/functions-sequence.html">http://www.postgresql.org/docs/9.2/static/functions-sequence.html</a>
      if appears the following will work:<br>
      <br>
      SELECT setval(oid, nextval(oid), false) FROM pg_class WHERE
      relkind = 'S'<br>
      <br>
      and my initial experiments suggest it does.<br>
      <br>
      Sean<br>
    </blockquote>
    <br>
    But later experiments show I'm back where I started.  :-(  Is there
    any way to get the current sequence value out into the WAL without
    disturbing it?<br>
    <br>
    Or am I looking at the wrong thing?  Is there some other logical
    reason why the sequence values were all off by one?<br>
    <br>
    Thanks,<br>
    Sean<br>
    <br>
  </body>
</html>