6

I'm following these instructions to upgrade postgres from 9.1 to 9.3: http://www.postgresql.org/docs/9.1/static/upgrading.html

When I restore (Step 8), I get a ton of messages like this: psql:/mnt/dumps/pre-upgrade.dump:61028: invalid command \N

Does anyone know the problem or can point me to a better upgrade instructions for Linux?

6
  • Are you using pg_upgrade? Looks like it from the filename, but it'd be good to confirm. If you are, show the entire log from pg_upgrade please. Pastebin it if it's too big for here. Edit question, comment here when done. Apr 9, 2014 at 0:53
  • No step 8 exactly "/usr/local/pgsql/bin/psql -d postgres -f outputfile"
    – Tony
    Apr 9, 2014 at 1:00
  • 4
    That message comes up whenever COPY tablename ... has a problem. Once the COPY command errors out, the remaining rows of the COPY command are interpreted as their own commands and produce spurious errors like this one. You'll need to look at the beginning of that list to see the actual error.
    – DerfK
    Apr 9, 2014 at 1:00
  • 1
    Using psql -v ON_ERROR_STOP=1 -f outputfile will help, btw, as it'll stop after the first error so you can see what it was. Did you make sure you're using the new version's pg_dump and psql like the instructions say? psql -V, pg_dump -V. Apr 9, 2014 at 1:08
  • Ah no I did not use a newer version of pg_dump. If it works with an older version should I be OK or should I kill the process now and redump/re-restore?
    – Tony
    Apr 9, 2014 at 1:18

1 Answer 1

0

I had a dump from pg_dump.
My error output was:

psql:export.sql:1: error: invalid command \n
psql:export.sql:2: ERROR:  syntax error at or near "ÿþ"

I tried escaping and replacing to fix \n, but still had the ÿþ error.
To fix the ÿþ error I tried encoding to UTF-8.

At some point i started all over, made a new export and only converted the export to UTF-8. No error was outputted anymore, so that fixed also the error: invalid command \n.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .