I am trying to create a dump of a table, which is stored inside my database.
The table is called
In order to create the dump, I use the following commands:
docker-compose exec db1 pg_dump -F tar -d db -U user -t webapp_product > /home/backup.tar
Then on the other machine:
sudo mv backup.tar ../pgdata
docker-compose exec db1 sh
pg_restore -Ft -C -U user -d db /var/lib/postgresql/data/pgdata/backup.tar
Unfortunately, this always results in the same scenario. I receive the following error log:
pg_restore: error: could not read from input file: end of file
I also tried the other way around. After moving the backup file, I tried to use:
cat /var/lib/postgresql/data/pgdata/backup.sql | psql -d db -U user
After invoking this command, I received an error saying that I could not create duplicates (the IDs of the records were the same.)
In order to go further, I tried to disable all the constraints, but without any expected effect.
The backup.tar file consists of the following lines:
-- File paths need to be edited. Search for $$PATH$$ and
-- replace it with the path to the directory containing
-- the extracted data files.
-- PostgreSQL database dump
-- Dumped from database version 12.1 (Debian 12.1-1.pgdg100+1)
-- Dumped by pg_dump version 12.1 (Debian 12.1-1.pgdg100+1)
Can it affect the data restore process?
and has a following end:
-- PostgreSQL database dump complete