how to export table backup without constraints and triggers in Postgres
we are using below command
pg_dump -h hostname -p 5432 -U postgres -d db -t --disable-triggers table -v -f "table.backup"
but for skipping constraints do we have any option in postgres?
This should dump the file, the grep
statement will delete line containing "TRIGGER":
pg_dump -h hostname -p 5432 -U postgres -d db -t --disable-triggers --format=p table | grep -v TRIGGER > "table.backup"
PS Assumption is made that there is no word "TRIGGER" in the data of the table.
EDIT: On Windows this should work:
pg_dump -h hostname -p 5432 -U postgres -d db -t --disable-triggers --format=p table | FINDSTR /V TRIGGER > "table.backup"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.