SQLite

View Ticket
Login
Ticket Hash: 302027baf1374498d6092313c65ba09f4e814f74
Title: VACUUM results in "database disk image is malformed" for PRIMARY KEY with duplicate column
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2019-11-07 14:51:45
Version Found In: 3.30.0
User Comments:
mrigger added on 2019-11-07 10:12:44: (text/x-fossil-wiki)
The following test case results in an unexpected error:

<pre>
CREATE TABLE t0(c0, c1 UNIQUE COLLATE NOCASE, PRIMARY KEY(c1, c1)) WITHOUT ROWID;
INSERT INTO t0(c1) VALUES(0);
VACUUM; -- unexpected: database disk image is malformed
</pre>

drh added on 2019-11-07 13:28:13: (text/x-fossil-wiki)
An alternative formulation of the problem:

<blockquote><verbatim>
CREATE TABLE t0(
  c0,
  c1 UNIQUE,
  PRIMARY KEY(c1, c1)
) WITHOUT ROWID;
INSERT INTO t0(c0,c1) VALUES('abc','xyz');
CREATE TABLE t1(
  c0,
  c1 UNIQUE,
  PRIMARY KEY(c1, c1)
) WITHOUT ROWID;
INSERT INTO t1 SELECT * FROM t0;
</verbatim></blockquote>

drh added on 2019-11-07 14:27:37: (text/x-fossil-wiki)
This appears to be a malfunction in the xfer optimization introduced by
check-in [db4b4c2c1e9f1ada] on 2019-01-24.