Package: cvstrac
Version: 2.0.1-3, when upgrading
Severity: normal

cvstrac requires converting the database from sqlite2 to sqlite3 format
when upgrading from pre 2.x versions.

However it seems the semantics of the .sql dump file have changed between 
versions or the .dump functionality from sqlite 2.8.17-4 is broken.

Following the instructions from /usr/share/doc/cvstrac/NEWS.Debian.gz
will yield an unuseable database in most cases (cvs with more than
10 minor revisions for a file).

The symptom is

Database Error
db_execute: Database execute failed

    BEGIN; CREATE TEMP TABLE old_filechng AS SELECT * FROM filechng; DROP
TABLE filechng; CREATE TABLE filechng( cn int, filename text, vers text,
prevvers text, chngtype int, nins int, ndel int, UNIQUE(filename,vers) );
INSERT INTO filechng(cn,filename,vers,nins,ndel) SELECT
cn,filename,vers,nins,ndel FROM old_filechng; UPDATE config SET value='1.8'
WHERE name='schema'; COMMIT;

Reason: columns filename, vers are not unique

being shown on the webpage.

The reason for this behaviour is, that the .dump command does not quote
the "vers" field when dumping, which makes sqlite3 interpret it as a 
floating point number when importing.

This causes 1.1 and 1.10 to map to "1.1" in the resulting database and thus
causes the uniqueness issues.

A way to correctly convert the database is:

sqlite mydb.db.sqlite2 .dump >mydb.sql

cat mydb.sql | \
sed -e "/^INSERT INTO filechng/s/\(([^,]*,[^,]*,\)\([0-9.]\+\)/\1'\2'/" \
>mydb.conv.sql

sqlite3 -bail mydb.conv.db <mydb.conv.sql


As the issue is actually not a cvstrac issue (but will manifest itself there
frequently), I suggest to just document it in the bugtracker or in the 
package docs so the workaround is found easily.

I further suggest to contact sqlite maintainers and eventually file a bug
against sqlite2.

-- System Information:
Debian Release: 5.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.26
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.utf-8 (charmap=UTF-8)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to