invalid command \N with pg_dump

When trying to restore a data-only pg_dump from postgres, I got this error about a billion times:

  invalid command \N
  invalid command \N
  invalid command \N

The problem here is not the invalid commands. It’s the fact that the real error is reported somewhere far up in your terminal history, long hidden by the trillions of lines of other output. So try it again, this time piping stdout and stderr to a file, so that you can see what the original error is. Like this:

  psql my_database < dump.sql &> db_restoration_output.txt

The advice on how to output stdout and stderr to a file comes from Stack Overflow

Now, you can search in the file to find what the real error is.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s