Just in case it's not obvious, this is a database that's part of my Firefox
profile. The database was likely corrupted during an upgrade to Firefox
(I've been speaking with the folks that work on Firefox profiles, too), but
I've also had a couple of kernel panics lately, and I imagine that could
either directly cause issues, or cause issues the next time Firefox starts
(and tries to recover).

With that said, I'm still not clear on one thing: how is it that the *new*
table and index I've created managed to fail the UNIQUE constraint? Unless
my SELECTs were lying to me (maybe due to the corruption?), there are no
duplicate guids in moz_places.


2016-11-02 17:27 GMT-04:00 Richard Hipp <d...@sqlite.org>:

> 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
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to