1515 *
1616 *
1717 * IDENTIFICATION
18- *$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.124 2006/02/13 21 :30:19 tgl Exp $
18+ *$PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.125 2006/02/14 23 :30:43 tgl Exp $
1919 *
2020 *-------------------------------------------------------------------------
2121 */
@@ -214,7 +214,12 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
214214dumpTimestamp (AH ,"Started on" ,AH -> createDate );
215215
216216if (ropt -> single_txn )
217- ahprintf (AH ,"BEGIN;\n\n" );
217+ {
218+ if (AH -> connection )
219+ StartTransaction (AH );
220+ else
221+ ahprintf (AH ,"BEGIN;\n\n" );
222+ }
218223
219224/*
220225 * Establish important parameter values right away.
@@ -377,7 +382,12 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt)
377382}
378383
379384if (ropt -> single_txn )
380- ahprintf (AH ,"COMMIT;\n\n" );
385+ {
386+ if (AH -> connection )
387+ CommitTransaction (AH );
388+ else
389+ ahprintf (AH ,"COMMIT;\n\n" );
390+ }
381391
382392if (AH -> public .verbose )
383393dumpTimestamp (AH ,"Completed on" ,time (NULL ));
@@ -652,10 +662,13 @@ EndBlob(Archive *AHX, Oid oid)
652662void
653663StartRestoreBlobs (ArchiveHandle * AH )
654664{
655- if (AH -> connection )
656- StartTransaction (AH );
657- else
658- ahprintf (AH ,"BEGIN;\n\n" );
665+ if (!AH -> ropt -> single_txn )
666+ {
667+ if (AH -> connection )
668+ StartTransaction (AH );
669+ else
670+ ahprintf (AH ,"BEGIN;\n\n" );
671+ }
659672
660673AH -> blobCount = 0 ;
661674}
@@ -666,10 +679,13 @@ StartRestoreBlobs(ArchiveHandle *AH)
666679void
667680EndRestoreBlobs (ArchiveHandle * AH )
668681{
669- if (AH -> connection )
670- CommitTransaction (AH );
671- else
672- ahprintf (AH ,"COMMIT;\n\n" );
682+ if (!AH -> ropt -> single_txn )
683+ {
684+ if (AH -> connection )
685+ CommitTransaction (AH );
686+ else
687+ ahprintf (AH ,"COMMIT;\n\n" );
688+ }
673689
674690ahlog (AH ,1 ,"restored %d large objects\n" ,AH -> blobCount );
675691}