On 11/2/16, Ben Hearsum <bhear...@mozilla.com> wrote:
>
> I then did some inserts, and discovered that the order in which the rows are
> inserted appears to be affecting the uniqueness of the index:
> sqlite> insert into moz_places_bhearsum select * from moz_places order by
> guid;
> sqlite> reindex moz_places_bhearsum;
> sqlite> delete from moz_places_bhearsum;
> sqlite> insert into moz_places_bhearsum select * from moz_places;
> sqlite> reindex moz_places_bhearsum;
> Error: UNIQUE constraint failed: moz_places_bhearsum.guid
>
> Is this a real bug, or am I misunderstanding something about the way things
> are supposed to work?
>

[Aside: Ben sent me the database via a private side-channel.]

The database is corrupt.  You can see this if you run "PRAGMA
integrity_check;"  Or if you run REINDEX; (with no arguments) you'll
immediately get the UNIQUE constraint failure.

All of the errors seem to be within indexes.  So normally a REINDEX
command would fix this.  But in your case, some of the UNIQUE
constraints are violated.

So the question becomes:  How did the database manage to go corrupt?

See https://www.sqlite.org/howtocorrupt.html for a list of known ways
to corrupt an SQLite database.  Are any of these applicable here?



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to