I'm trying to restore my dump file, but it caused an error:
psql:psit.sql:27485: invalid command \N
Is there a solution? I searched, but I didn't get a clear answer.
I'm trying to restore my dump file, but it caused an error:
psql:psit.sql:27485: invalid command \N
Is there a solution? I searched, but I didn't get a clear answer.
I have run into this error in the past as well. Pavel is correct, it is usually a sign that something in the script created by pg_restore is failing. Because of all the "/N" errors, you aren't seeing the real problem at the very top of the output. I suggest:
pg_restore --table=orders full_database.dump > orders.dump
)orders.dump
and delete a bunch of records)In my case, I didn't have the "hstore" extension installed yet, so the script was failing at the very top. I installed hstore on the destination database, and I was back in business.
For me using postgreSQL 10 on SUSE 12, I resolved the
invalid command \N
error by increasing disk space. Lack of disk space was causing the error for me. You can tell if you are out of disk space if you look at the file system your data is going to in thedf -h
output. If file system/mount is at 100% used, after doing something likepsql -f db.out postgres
(see https://www.postgresql.org/docs/current/static/app-pg-dumpall.html) you likely need to increase the disk space available.Same thing was happened to me today. I handled issue by dumping with --inserts command.
What I do is:
1) pg_dump with inserts:
2) psql (restore your dumped file)
Note-1 ) Make sure that adding outputfile will increase speed of import.
Note-2 ) Do not forget to create table with exact same name and columns before importing with psql.
Postgres uses "\N" as substitute symbol for NULL value. But all psql commands starts by backslash "\" symbol. So you can get this messages, when probably copy statement fails, but a loading of dump continues. This message is only false alarm. You have to search a lines before for reason why COPY statement fails.
Is possible to switch psql to "stop on first error" mode and to find error: