pg_restore throws end of line error when the dump file is edited

75 Views Asked by At

using pg_dump to dump the database in a custom format archive

pg_dump -U $PG_USER -d $PG_DB -a --column-inserts -Z 0 -Fc > db.dump

i have to use subquery to create new temporary tables based on the real tables.

now i dump those tables using the above command but i must edit the db.dump file in nodejs just to replace a temporary tables names with real tables.

the problem is wheni edit in node by just reading the file and replacing the string with replaceAll it does not get through with pg_restore.

pg_restore throws the below error

pg_restore: error: could not read from input file: end of file

perhaps editing binary file is somehow messing up with byte order or end of line ?

0

There are 0 best solutions below