I had to reset my Pre this week because it wouldn't install new applications, probably as a result of letting WebOS upgrade while some patches were still enabled. Anyway, after the factory restore was finished (using WebOS Doctor) I started re-enabling my accounts in email and contacts. When I did so, I got a bunch of duplicate contact records that would not stay open. Every time I tapped on one, it would pop up for a moment, blank, and then immediately close. Even after removing all my accounts from the system, these contacts remained, exhibiting that same behavior.
Obviously, this was unwanted, so I did a little research. Below are instructions for how I killed those duplaicate contacts without resetting my system again or creating a new Palm Profile (both of which seem like really stupid solutions, anyway).
First, I logged into the Pre via shell. I figure for most people who have this problem, you've probably already got the SDK installed, since hacking on the Pre is what I think caused my issues in the first place. But it's pretty easy to install the SDK and get to a shell prompt even if you don't already have it.
I fiddled a bit trying to get XShell (my ssh terminal - it's like Putty) to connect, but decided "why bother?" and just used the novacom -t open tty:// command to get the shell right at the Windows command line.
Second, at the shell, I got an interactive session with SQLite, opening the contacts database:
That's easy enough. While you're in there, you can use regular SQL to query for your contacts and see what the Pre knows. The com_palm_pim_Person table has a list of contacts. You can get a list of everything in there using the standard SQL query:
SELECT * FROM com_palm_pim_Person;
If you have a lot of contacts, a lot of data could whiz by.
Third, I added the special library to SQLite that allows it to obey the special collation that they've applied to the Person table. You'll notice this if you try to add or delete anything from the table, since it'll give you a message like:
no such collation sequence: LOCALIZED_SECONDARY
That's because SQLite doesn't know how to collate (read as "sort" for want of a definition) the rows in that table without that special library loaded. Fortunately, the solution is simple. I just ran this command to add the library to the sqlite3 client:
Note the dot in front of "load".
Fourth, I deleted everything in the table:
DELETE FROM com_palm_pim_Person;
I suppose I could have picked and chosen if I wanted to keep anything, but all of the contacts left in my table were bad ones, so I just deleted everything.
When I quit out of SQLite (The sqlite3 command is ".quit") and looked at my contacts, everything was gone. Hurray!