I am looking for a way to properly edit a toc.dat
file generated by a pg_dump
.
The idea is to rename the schema’s name before the data import with pg_restore
.
pg_dump -j 2 --host localhost -p 5433 -Fd --dbname dbname --username username -n schema -f directory
So far I have tried to do so with a perl or sed command :
sed -i.bak -e 's/schema./schema_new./g' -e 's/schema;/schema_new;/g' toc.dat
However, I got a segmentation fault error
[1] 22867 segmentation fault pg_restore --no-owner --no-acl -h localhost -p 5433 -U username -d -n
when I try to pg_restore
:
pg_restore --no-owner --no-acl -h localhost -p 5433 -U username -d other_dbname -n schema_new -v directory
I know that I could bypass this issue with a textual pg_dump
file but if possible I would like to stick with the toc.dat
method for memory storage optimization.
Thanks !
PostGres version : 14.10
pg_dump/pg_restore version : 15.6
jlnvn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.