On Tue, Sep 15, 2009 at 8:50 PM, Tito Ciuro <tci...@mac.com> wrote: > On Sep 15, 2009, at 6:42 PM, P Kishor wrote: > >> Could it be that those seemingly identical multiple rows actually have >> trailing spaces or some other non-visible character? Check for their >> length. > > Here we go: > >> sqlite> SELECT clientName, entityName, length(entityName) FROM MyDBState >> ORDER BY entityName; >> com.apple.AddressBook|com.apple.contacts.CalendarURI|30 >> com.apple.AddressBook|com.apple.contacts.Contact|26 >> com.apple.AddressBook|com.apple.contacts.Date|23 >> com.apple.AddressBook|com.apple.contacts.Email Address|32 >> com.apple.AddressBook|com.apple.contacts.Group|24 >> com.apple.AddressBook|com.apple.contacts.IM|21 >> com.apple.AddressBook|com.apple.contacts.ImageTransformationInfo|42 >> com.apple.AddressBook|com.apple.contacts.ImageTransformationInfo|42 >> com.apple.AddressBook|com.apple.contacts.Phone Number|31 >> com.apple.AddressBook|com.apple.contacts.Phone Number|31 >> com.apple.AddressBook|com.apple.contacts.Related Name|31 >> com.apple.AddressBook|com.apple.contacts.Related Name|31 >> com.apple.AddressBook|com.apple.contacts.SmartGroup|29 >> com.apple.AddressBook|com.apple.contacts.SmartGroup|29 >> sqlite> >
punk...@lucknow ~/Desktop/stuff$sqlite3 SQLite version 3.6.11 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> CREATE TABLE MyDBState (clientName TEXT, entityName TEXT,propertyNames BLOB, PRIMARY KEY (clientName, entityName)); sqlite> INSERT INTO MyDBState (clientName, entityName) VALUES ('com.apple.AddressBook', 'com.apple.contacts.SmartGroup'); sqlite> INSERT INTO MyDBState (clientName, entityName) VALUES ('com.apple.AddressBook', 'com.apple.contacts.SmartGroup'); SQL error: columns clientName, entityName are not unique SQLite should stop you from inserting duplicate PK right away, like above. By the way, in your original post, you gave a different name for your table... see below -- > 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; Where did SyncState come from? Is that different from MyDBState? Or, was that just a typo? Maybe some of the folks knowing more about the innards of the software can help. Which version are you using? -- Puneet Kishor _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users