PDA

View Full Version : Simple PostgreSQL question



xyz456
11-24-2009, 02:54 AM
I have been using version 8.3 for several weeks, and just upgraded to 8.4 today. However, when I use 8.4 Holdem Manager thinks I am using a new database. How can I use HM/PG8.4 with my old database?

Patvs
11-24-2009, 03:20 AM
START--->PostgreSQL 8.4--->pgAdminIII--->
You should see two databases in pgAdminIII:

-PostgreSQL 8.3 (port: 5432) <---this one contains your old database
-PostgreSQL 8.4 (port: 5432)

Click on the 8.3 (password: postgrespass), click on databases, rightclick on your HoldemManager database and select BACKUP. Remember the filename (and save location of the .backup file) and just press OK.

**Doing the backup can take some time (and take up all CPU use), you can IGNORE the "pgAdminIII is not responding" error. It's still doing the backup**

When it's finished, click on the PostgreSQL 8.4 (port: 5432) and create a new database. RESTORE your old database, by directing the restore option to the .backup file that was just created.

xyz456
11-24-2009, 04:41 AM
I tried to follow your instructions, but I am very confused. Right now in pgAdmin III I see three different databases for 8.3, and also three for 8.4 (with the same names). But none of these seem to be my original database -- how can I figure out which one was supposed to be the original database? HoldemManager runs fine, but it thinks I am using a new database. I don't seem to be able to even start PostgreSQL 8.3 now to retrieve my old database.

xyz456
11-24-2009, 04:55 AM
I tried the backup procedure again, but get this error:

C:\Program Files\PostgreSQL\8.3\bin\pg_dump.exe --host localhost --port 5432 --username postgres --format custom --blobs --verbose --file "C:\Users\Sam\Documents\HoldemManager_backup.backup" "HoldemManager"
pg_dump: server version: 8.4.1; pg_dump version: 8.3.7
pg_dump: aborting because of version mismatch (Use the -i option to proceed anyway.)
pg_dump: *** aborted because of error

Process returned exit code 1.

Patvs
11-24-2009, 05:39 AM
Was your old 8.3 database in the default ASCII encoding and your new 8.4 database in the new default UTF8 encoding? Because those are not compatible.

Forget about pgAdminIII, just

Uninstall 8.4
Reinstall 8.3--->export your database (in HoldemManager--->OPTIONS-->database management--->export hands)
Uninstall 8.3
Reinstall 8.4--->reimport your just exported hands in HoldemManager

-----

Nah..... that's so much work! If you have a large database, the backup/restore in pgAdminIII can easily take 1+ hour.... each, and the exporting hands can take a long time, and results in LARGE .txt files which take longer to import than your original handhistory files.

Can't you just re-import all your old actual handhistories (the .txt files). from your archive folder. (preferably in a NEW database, and afterwards delete ALL your old databases in pgAdminIII)

xyz456
11-24-2009, 02:22 PM
Ok thanks, re-importing the old hand histories worked, though it took 3+ hours and obviously isn't a great long-term solution in case I have to update postgreSQL again, since I will have many more hand histories in the future.

Patvs
11-24-2009, 05:15 PM
Now that you have you database in the right encoding (PostgreSQL 8.4 in UTF8 encoding) after the 3+ hour import...

VACUUM the database, purge hands you don't need, and create a good backup.
So in the future, you can just RESTORE the backup file.
However, I reimport all my handhistories about twice a year. A year ago when HoldemManager added the "luck adjusted winnings" for SNGs/MTTs required a new database,... and next year with the new $EV by street, will surely require a new database and reimport.