Forum OpenACS Q&A: Upgrade PG 7.3.4 to 7.4.1

Collapse
Posted by Malte Sussdorff on
As a lot of you most likely have already done the upgrade to the latest PG version, here is a question for you.

How did you do it ?

I tried the commands outlined in the backup guide, but it failed with "invalid command \N", which is due to a change in the copy functionality of pg_dump from 7.3.4 to 7.4.1.

Next try was "pg_dump -d", but it breaks somewhere in between (and getting 160MB of data via inserts into the database is not my ideal day).

My last idea had been to install PG 7.4 on the same machine as 7.3.4 and use the PG 7.4 pg_dump. But this did not work either.

Any other ideas (short of getting rid of all \N via perl and replace it with something different) ? How is the experience with pg_dump/pg_restore ?

Collapse
Posted by Bruce Spear on
Malte, I can't help, only sympathize: I could not find a way to import my 7.3 dump into a new 7.4 database, either, so I'd love to hear a success story and read the documentation informing it!
Collapse
Posted by Joel Aufrecht on
I think the debian upgrade script includes the convolutions necessary to do this - ie, preserving old binaries, etc.  It seems like the PostGreSQL upgrade team did it to us again.
Collapse
Posted by Dave Bauer on
Malte,

Did you run pg_dump from 7.3.4 before attempting to upgrade? I used this method and it worked for me. I wonder what the different might be.

Collapse
Posted by Malte Sussdorff on
Steps tried:

7.3.4. pg_dump, 7.4.1 psql
7.3.4. pg_dump, 7.4.1 pg_restore
7.3.4. pg_dump, 7.3.4 pgsql (on 7.4 database)
7.4.1. pg_dump, 7.4.1 psql
7.3.4. pg_dump, 7.3.6 pgsql/pg_dump, 7.4.1 psql

All failed with "invalid command \N". I'm curious as well if it worked for you....

Collapse
Posted by Steve Manning on
Is it something in your data thats being inteprepted incorrectly? Are you dumping blobs as well? Can you see the \N in the file?

If your not dumping blobs you might also want to try a different --format.

I did an upgrade from 7.3 to 7.4 by dumping plaintext in 7.3 then upgrading to 7.4 and importing and that worked fine (it wasn't an OpenACS instance tho).

You might also want to try two dumps one for data (-a) and one for schema (-s) to see if you can narrow it down.


    - Steve

Collapse
Posted by Bruno Mattarollo on
I did a pg_dump from 7.3.4 (server running RH 9) and then psql into 7.4 (on Panther -Mac OS X 10.3-) and it worked fine, no errors.

PG 7.4.2 was released today, compiling it and will let you know when I have time to try that as well.

/B

Collapse
Posted by Tilmann Singer on
I did a restore of a pg 7.4.1 dump on a pg 7.4.1 database recently and saw the same error. It turned out that it works when omitting the manual loading of postgresql.sql before restoring the dump, maybe the same applies to upgrades.
Collapse
Posted by C. R. Oldham on
<blockquote> PG 7.4.2 was released today
</blockquote>

Note this is already in Debian Unstable.  I upgraded to it today.

Collapse
Posted by Malte Sussdorff on
Tilmann, you are hereby declared saviour of the day :). It works.

Now someone has to make a note on that in the documentation....

Collapse
Posted by C. R. Oldham on
When browsing the HISTORY file for 7.4.2 I discovered the following:

[...] A dump/restore is not required for those running 7.4.X.  However, it may be advisable as the easiest method of incorporating fixes for two errors that have been found in the initial contents of 7.4.X system catalogs. A dump/initdb/reload sequence using 7.4.2's initdb will automatically correct these problems. [...]

The HISTORY file documents how to manually fix the problems without a dump/initdb/reload.

Oliver Elphick, the Debian Pg package maintainer informs me that if you were running the 7.4.1 Debian package before, the 7.4.2 package does NOT automatically install these fixes.

Collapse
Posted by Mark McI on
Hello Malte,

I am experiencing this EXACT problem.  I see that Tillman suggested omitting the manual loading of postgresql.sql. Can you briefly explain what that is?

I am dumping with pg_dump and restoring with the following command:
psql -e dbname < db_dump.sql

Any help you can provide will be MUCH appreciated as I'm inexperienced with postgres and totally stumped.

Collapse
Posted by Rocael Hernández Rizzardini on
do
psql -f packages/acs-kernel/sql/postgresql/postgresql.sql dbname

(that should do the trick)

when I restore a dump, usually do something like:
psql -f dump.file dbname