Lists: | pgsql-bugs |
---|
From: | "Konstantin Pelepelin" <cat(at)dtf(dot)ru> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #2727: pg_restore error on BLOB COMMENTS |
Date: | 2006-10-31 18:04:36 |
Message-ID: | 200610311804.k9VI4a04027253@wwwmaster.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
The following bug has been logged online:
Bug reference: 2727
Logged by: Konstantin Pelepelin
Email address: cat(at)dtf(dot)ru
PostgreSQL version: 8.1.5
Operating system: RHEL4
Description: pg_restore error on BLOB COMMENTS
Details:
I think, it is part of bug #2452 (
http://archives.postgresql.org/pgsql-bugs/2006-05/msg00113.php ), it is not
fixed in 8.1.5
$ pg_restore -v -U postgres -d mydb --disable-triggers -S postgres mydb.tar
...
pg_restore: restoring large object OID 70380132
pg_restore: restored 5116 large objects
pg_restore: restoring BLOB COMMENTS
pg_restore: [tar archiver] could not find header for file 2004.dat in tar
archive
pg_restore: *** aborted because of error
$ pg_restore -l mydb.tar |grep 2004
2004; 0 0 BLOB COMMENTS - BLOB COMMENTS
2004.dat exists in archive and consists of single LF
Workaround:
(pg_restore -l $DBFILE | fgrep -v '0 0 BLOB COMMENTS - BLOB COMMENTS'
>pg_restore_list.txt)
pg_restore -v -U postgres -d $DB --disable-triggers -S postgres -L
pg_restore_list.txt $DBFILE
rm -f pg_restore_list.txt
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Konstantin Pelepelin" <cat(at)dtf(dot)ru> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #2727: pg_restore error on BLOB COMMENTS |
Date: | 2006-10-31 23:18:37 |
Message-ID: | 9919.1162336717@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
"Konstantin Pelepelin" <cat(at)dtf(dot)ru> writes:
> pg_restore: restoring large object OID 70380132
> pg_restore: restored 5116 large objects
> pg_restore: restoring BLOB COMMENTS
> pg_restore: [tar archiver] could not find header for file 2004.dat in tar
> archive
> pg_restore: *** aborted because of error
Hmm ... it looks like blob comments never have worked in tar format,
or not recently anyway. _LoadBlobs() runs off the end of the archive
file and then there's no mechanism for backing up --- not that that
would work anyway if reading from a pipe. I'm thinking of fixing it
like this (against HEAD, but the code hasn't changed much lately):
*** src/bin/pg_dump/pg_backup_tar.c.orig Tue Oct 3 23:16:46 2006
--- src/bin/pg_dump/pg_backup_tar.c Tue Oct 31 17:27:54 2006
***************
*** 701,706 ****
--- 701,707 ----
lclContext *ctx = (lclContext *) AH->formatData;
TAR_MEMBER *th;
size_t cnt;
+ bool foundBlob = false;
char buf[4096];
StartRestoreBlobs(AH);
***************
*** 725,734 ****
ahwrite(buf, 1, cnt, AH);
}
EndRestoreBlob(AH, oid);
}
}
-
- tarClose(AH, th);
th = tarOpen(AH, NULL, 'r');
}
--- 726,745 ----
ahwrite(buf, 1, cnt, AH);
}
EndRestoreBlob(AH, oid);
+ foundBlob = true;
}
+ tarClose(AH, th);
+ }
+ else
+ {
+ tarClose(AH, th);
+ /*
+ * Once we have found the first blob, stop at the first
+ * non-blob entry (which will be 'blobs.toc').
+ */
+ if (foundBlob)
+ break;
}
th = tarOpen(AH, NULL, 'r');
}
Thanks for the report!
regards, tom lane