Final (?) fix for tar (null block at end)
authorPhilip Warner <pjw@rhyme.com.au>
Wed, 25 Oct 2000 10:21:38 +0000 (10:21 +0000)
committerPhilip Warner <pjw@rhyme.com.au>
Wed, 25 Oct 2000 10:21:38 +0000 (10:21 +0000)
Dump template db in dumpall

src/bin/pg_dump/pg_backup_archiver.h
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_dumpall.sh

index 417c50bf68a859a3742f1fa8a6fd2d13b6ec2276..41fbb5c9c06a0918aeb480969105629cd0974a94 100644 (file)
@@ -62,7 +62,7 @@ typedef z_stream *z_streamp;
 
 #define K_VERS_MAJOR 1
 #define K_VERS_MINOR 4 
-#define K_VERS_REV 20 
+#define K_VERS_REV 21 
 
 /* Data block types */
 #define BLK_DATA 1
index 674c24191dc14f613ee8cfb275fd691994d0c835..a137513e78c2e6f15bcb1352df851465bd4a8347 100644 (file)
@@ -721,7 +721,7 @@ static void _CloseArchive(ArchiveHandle* AH)
        lclContext*             ctx = (lclContext*)AH->formatData;
        TAR_MEMBER              *th;
        RestoreOptions  *ropt;
-       int                             savVerbose;
+       int                             savVerbose, i;
 
     if (AH->mode == archModeWrite) {
 
@@ -774,6 +774,13 @@ static void        _CloseArchive(ArchiveHandle* AH)
                AH->public.verbose = savVerbose;
 
                tarClose(AH, th);
+
+               /* Add a block of NULLs since it's de-rigeur. */
+               for(i=0; i<512; i++) 
+               {
+                       fputc(0, ctx->tarFH);
+               }
+
     }
 
     AH->FH = NULL; 
index 27c6bc748a054f67b3617243e13dd124b04161bd..04ab750d3950acf081df9b6c2bc863253e51431f 100644 (file)
@@ -179,6 +179,20 @@ while read GRONAME GROSYSID GROLIST ; do
 done
 
 
+# First we dump the template in case there are local extensions.
+
+echo
+echo "--"
+echo "-- Database template1"
+echo "--"
+echo "${BS}connect template1"
+$PGDUMP "template1"
+if [ "$?" -ne 0 ] ; then
+    echo "pg_dump failed on template1, exiting" 1>&2
+    exit 1
+fi
+
+
 # For each database, run pg_dump to dump the contents of that database.
 
 $PSQL -d template1 -At -F ' ' \