Hi, With the following test case pgdump creates a corrupt tar file i.e.
CREATE DATABASE dump_test; > \c dump_test > CREATE TABLE test_table1 (int1 int); > INSERT INTO test_table1 (SELECT * FROM generate_series(1, 1000)); > \! pg_dump -F t -f dump_test.tar dump_test Debugging shows that pg_dump tries to fopen tar file with "w" option that corrupts already opened archive file i.e. _CloseArchive() -> RestoreArchive() -> SetOutput() -> fopen(filename, > PG_BINARY_W); man fopen > ... > ... > w > Truncate file to zero length or create text file for writing. The > stream is positioned at the beginning of the file. This issue is caused by addition of the following code in function _CloseArchive() i.e. > memcpy(ropt, AH->ropt, sizeof(RestoreOptions)); It was intruduced by recent patch is as following i.e. > commit 4317e0246c645f60c39e6572644cff1cb03b4c65 > Author: Tom Lane <t...@sss.pgh.pa.us> > Date: Tue May 29 23:22:14 2012 -0400 > Rewrite --section option to decouple it from --schema-only/--data-only. PFA patch. Thanks. Best Regards, Muhammad Asif Naeem
pg_backup_tar.c.patch.pg
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers