I tried all of this then also kept having this error when running the SQL query:
Code:
ERROR: duplicate key value violates unique constraint "tourney_hand_player_statistics_primary_key"
Which did not make sense because I definitely did NOT have any observed hands, no other hands than heads up hands, or more than one hero name. Then I found out why.
The id_player corresponding to your screenname is not necessary 1.
In my case it was 2, I am guessing that when PT4 imports the very first HH in your new database, your opponent might get id_player number 1, therefore you get number 2. Talk about a coinflip
So while you're looking at the "players" table to find out who has the last id_player, find out if you have number 1 or 2 (or else maybe). Then in the SQL query, replace all statements with "!=1" by "!=your_own_id_player". For example, if it happens to be 2:
Code:
UPDATE tourney_hand_summary SET id_winner = 1446 WHERE id_winner != 2 AND id_winner != 0 AND id_winner != -1;
UPDATE tourney_hand_player_statistics SET id_player = 1446 WHERE id_player != 2 AND id_player != 0 AND id_player != -1;
UPDATE tourney_hand_player_combinations SET id_player = 1446 WHERE id_player != 2 AND id_player != 0 AND id_player != -1;
UPDATE tourney_summary SET id_winner = 1446 WHERE id_winner != 2 AND id_winner != 0 AND id_winner != -1;
UPDATE tourney_results SET id_player = 1446 WHERE id_player_real != 2 AND id_player_real != 0 AND id_player_real != -1;
UPDATE player SET id_player_alias = 1446 WHERE id_player != 2 AND id_player != 0 AND id_player != -1;
Where 1446 is still to be replaced with the last id_player in the "players" table.
Secondly,
I also recommend backing up the "new" database before running the SQL query. You don't want to spend what could be another couple of hours doing the import all over again because something with the query goes wrong, see the next point.
Finally,
before you run the SQL query in your new database, launch PT4 and go to view stats -> results, and from the drop down "player" menu, select the name of the player who was last in your "player" SQL table.
Then only after that go run the SQL query. If I don't do this before running the query, I cannot select any other player than myself afterwards in PT4, which sort of defeats the whole point. Might have to do with the merging of all player ids, and PT4 getting confused.
Hopefully this helps, and of course, big thanks to Ben, Dave and anyone involved, there is probably a goldmine of info to analyze now
Last edited by CJSaunders; 03-12-2013 at 03:09 AM.