"Konstantin Pelepelin" <[EMAIL PROTECTED]> 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

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

Reply via email to