On Tue, Sep 15, 2009 at 4:22 PM, Tito Ciuro <tci...@mac.com> wrote: > Hello, > > On Sep 15, 2009, at 12:55 PM, D. Richard Hipp wrote: > >> >> On Sep 15, 2009, at 3:33 PM, Tito Ciuro wrote: >> >>> Hello, >>> >>> Given the following pragma integrity_check output: >>> >>>> sqlite> pragma integrity_check; >>>> rowid 106931 missing from index sqlite_autoindex_MyDBState_1 >>>> rowid 106933 missing from index sqlite_autoindex_MyDBState_1 >>>> rowid 106935 missing from index sqlite_autoindex_MyDBState_1 >>>> wrong # of entries in index sqlite_autoindex_MyDBState_1 >>> >>> Does this mean that: >>> >>> 1) the index is corrupted >>> 2) the rowids are truly missing (data loss) >>> >>> Running vacuum doesn't solve the problem. >> >> It means the index is corrupt. Try running "REINDEX". > > When I run REINDEX I get the following error: > >> SQL error: indexed columns are not unique > > The table was created like this: > >> CREATE TABLE MyDBState (clientName TEXT, entityName TEXT, >> propertyNames BLOB, PRIMARY KEY (clientName, entityName)) > > If I output the data using sqlite3, I get: > >> sqlite> SELECT clientName, entityName FROM SyncState ORDER BY >> entityName; >> com.apple.AddressBook|com.apple.contacts.CalendarURI >> com.apple.AddressBook|com.apple.contacts.Contact >> com.apple.AddressBook|com.apple.contacts.Date >> com.apple.AddressBook|com.apple.contacts.Email Address >> com.apple.AddressBook|com.apple.contacts.Group >> com.apple.AddressBook|com.apple.contacts.IM >> com.apple.AddressBook|com.apple.contacts.ImageTransformationInfo >> com.apple.AddressBook|com.apple.contacts.ImageTransformationInfo >> com.apple.AddressBook|com.apple.contacts.Phone Number >> com.apple.AddressBook|com.apple.contacts.Phone Number >> com.apple.AddressBook|com.apple.contacts.Related Name >> com.apple.AddressBook|com.apple.contacts.Related Name >> com.apple.AddressBook|com.apple.contacts.SmartGroup >> com.apple.AddressBook|com.apple.contacts.SmartGroup >> sqlite> > >
well, your clientName, entityName combo is not unique in the list above, and it should be given it is a PK. I have no idea how you managed to insert these rows while the PK constraint was active. > Thanks again, > > -- Tito > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Puneet Kishor _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users