<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi,<br>
    <br>
    I've run into a strange problem where in some cases package version
    numbers would roll back. Eventually I tracked the issue to prserv
    apparently not doing the right thing when running in the default
    nohist mode.<br>
    <br>
    As a simple example, I have this in PRMAIN_nohist:<br>
    <br>
    <code> version</code><code>                 pkgarch   
      checksum                             value<br>
------------------------------------------------------------------------------<br>
    </code><code>"beyonwiz-base-1.3-r0"    "all"   
      "d87bfea4ce066ec8b6041a8d3188956b"    "43"
</code><code><br>
    </code><code>"beyonwiz-base-1.3-r0"    "all"   
      "bba78fccad5b1b5ec9841a4002bd0252"    "42"
</code><code><br>
    </code><br>
    I think the problem is the primary key used for the nohist table. It
    should not include the checksum column.<br>
    <br>
    <code>PRMAIN_nohist</code> should be created only with  <code>PRIMARY
      KEY(version,pkgarch)</code><br>
    <br>
    To fix up an existing database, the following SQL code can be used:<br>
    <br>
    <code>CREATE TABLE PRMAIN_nohist2 (`version`    TEXT NOT NULL,   
      `pkgarch`    TEXT NOT NULL,    `checksum`    TEXT NOT NULL,   
      `value`    INTEGER,    PRIMARY KEY(version,pkgarch));</code><code><br>
    </code><code>insert or replace into PRMAIN_nohist2 (version,
      pkgarch, checksum, value) select version, pkgarch, checksum, value
      from PRMAIN_nohist order by value;</code><code><br>
    </code><code>drop table PRMAIN_nohist ;</code><code><br>
    </code><code>alter table PRMAIN_nohist2 rename to PRMAIN_nohist ;</code><code><br>
    </code><br>
    <br>
    Cheers,<br>
    <br>
        Peter<br>
    <br>
  </body>
</html>