Hi,

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.

As a simple example, I have this in PRMAIN_nohist:

 version                 pkgarch    checksum                             value
------------------------------------------------------------------------------
"beyonwiz-base-1.3-r0"    "all"    "d87bfea4ce066ec8b6041a8d3188956b"    "43"
"beyonwiz-base-1.3-r0"    "all"    "bba78fccad5b1b5ec9841a4002bd0252"    "42"

I think the problem is the primary key used for the nohist table. It should not include the checksum column.

PRMAIN_nohist should be created only with  PRIMARY KEY(version,pkgarch)

To fix up an existing database, the following SQL code can be used:

CREATE TABLE PRMAIN_nohist2 (`version`    TEXT NOT NULL,    `pkgarch`    TEXT NOT NULL,    `checksum`    TEXT NOT NULL,    `value`    INTEGER,    PRIMARY KEY(version,pkgarch));
insert or replace into PRMAIN_nohist2 (version, pkgarch, checksum, value) select version, pkgarch, checksum, value from PRMAIN_nohist order by value;
drop table PRMAIN_nohist ;
alter table PRMAIN_nohist2 rename to PRMAIN_nohist ;


Cheers,

    Peter